Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

loop until new line and file overwriting problems

Status
Not open for further replies.

dazed1

Programmer
Jul 29, 2002
1
US
I am writing a find and compare script that must loop until it finds two new lines in a row.

I also have another dilemma: I have created a file, but every time I run my macro, it overwrites the data I had previously stored in that file instead of adding it on to the end. Can anyone tell me how avoid overwriting the data every time you write to it?


Erin
 
You'll need to search for vbCrLf & vbCrLf
For example:
BufferPos = InStr(1, Buffer, vbCrLf & vbCrLf)

vbCrLf is equivalent to Chr(13) + Chr(10), which is a carriage return, line feed combination.


If you want to append to a file, then when you use the Open statement, you should use the Append mode.

Open "C:\info.log" For Append As #1
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top