Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
inet
active_desktop
active_scrptng
asp.components
asp.db
asp.general
comctl32
comp.packaging
components.dev
dbweb
dhtml_editing
docobjects
html_authoring
html_objmodel
iis
iis.ftp
iis.security
iis.smtp_nntp
indexserver
misc
mshtml_hosting
scripting.jscript
scripting.vbscript
sdk_setup
shell_objmodel
urlmonikers
webbrowser_ctl
wininet
  
 
date: Wed, 14 May 2008 09:59:00 -0700,    group: microsoft.public.inetsdk.programming.scripting.vbscript        back       


Insert blank rows when merging files   
Hi,

I have an HTA that is used to merge several hundred text files and in the 
snippet below, I show how I write the file name at the beginning of each 
merged chunk of data. This all works very well, but I would like to have the 
code actually insert two blank rows before and after each next file name; Can 
someone please correct my code below so that this will happen:

For Each oFile in oFolder.Files
   If UCase(oFSO.GetExtensionName(oFile)) = "SQL" Then
      mlFileCountEND = mlFileCountEND + 1
      sFileNameSRC = [INSERT ROWS] & "--" & oFile.Name & [INSERT ROWS]
      oMergeFile.WriteLine sFileNameSRC
      Set oSourceSTREAM = oFile.OpenAsTextStream(ForReading, 
TriStateUseDefault)
      Do
         sLine = oSourceSTREAM.ReadLine
         oMergeFile.WriteLine sLine
      Loop Until oSourceSTREAM.AtEndOfStream         
      oSourceSTREAM.Close
   End IF
Next
oMergeFile.Close

Thanks much in advance.
date: Wed, 14 May 2008 09:59:00 -0700   author:   XP

RE: Insert blank rows when merging files   
Issue resolved. In case anyone is interested: 

I was trying to use stuff like: Chr(13)

However, I cracked it by just inserting blank lines like so (duh):

oMergeFile.WriteLine ""
oMergeFile.WriteLine ""
oMergeFile.WriteLine sFileNameSRC
oMergeFile.WriteLine ""
oMergeFile.WriteLine ""

Issue resolved.

"XP" wrote:

> Hi,
> 
> I have an HTA that is used to merge several hundred text files and in the 
> snippet below, I show how I write the file name at the beginning of each 
> merged chunk of data. This all works very well, but I would like to have the 
> code actually insert two blank rows before and after each next file name; Can 
> someone please correct my code below so that this will happen:
> 
> For Each oFile in oFolder.Files
>    If UCase(oFSO.GetExtensionName(oFile)) = "SQL" Then
>       mlFileCountEND = mlFileCountEND + 1
>       sFileNameSRC = [INSERT ROWS] & "--" & oFile.Name & [INSERT ROWS]
>       oMergeFile.WriteLine sFileNameSRC
>       Set oSourceSTREAM = oFile.OpenAsTextStream(ForReading, 
> TriStateUseDefault)
>       Do
>          sLine = oSourceSTREAM.ReadLine
>          oMergeFile.WriteLine sLine
>       Loop Until oSourceSTREAM.AtEndOfStream         
>       oSourceSTREAM.Close
>    End IF
> Next
> oMergeFile.Close
> 
> Thanks much in advance.
date: Wed, 14 May 2008 11:49:03 -0700   author:   XP

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us