Text File Manipulation in ActiveX -
10-10-2006
, 12:02 PM
Hi,
I am wanting to be able to loop through a text file from a DTS package
that looks to check that the line length is 720 characters. If it is
not 720 characters then I want to add blank space to take it up to 720
characters.
A colleague gave me the following code:
Dim TextLine, TempStr
Open "c:\test.txt" For Input As #1
LineInput #1, TextLine
Open "c:\test2.txt" For Output As #2
Do While Not EOF(1)
While Len(TextLine) < 720
TextLine = TextLine + " "
Wend
Print #2, TextLine
Loop
Close #1
Close #2
This doesn't look 100% correct to me, but I can't work out where he's
gone wrong. It doesn't work when i try to run the code in DTS Package.
Can anyone help?
Many thanks
Chris |