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!

Append to beginning of a text file 1

Status
Not open for further replies.

PoppapumpJ

Programmer
Dec 17, 2001
86
US
I can append to the end of a file fairly easily. Is there a simple way to just append to the beginning of the file? If not, does anyone have examples to do so?

Thanks
 
You'll need to read the contents of the text file into a string variable, put what you want to be at the beginning of the file into another variable, and then concatenate the two:

dim theFile, theBeginning
theFile = "here's what is now in the text file"
'Obviously, the above line will need to be replaced w/ FSO methods to get the actual contents into the variable

theBeginning = "I'm going to stick this at the beginning"

dim theTextFile
theTextFile = theBeginning & theFile

Very simplified, but this is the general method you'll need to use.

:)
paul
penny.gif
penny.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top