Hi there,
I'm using File System Object to append to the text file.
When we append to file it always write the text at the end of the file.
But I want to write the text at the begining of the file.
Does anybody know the solution?
I think the FSO append function will only add to the end. So how about trying this:
- Open the file using FSO.
- Read the contents of the file and assign it to a string variable, call it fileText.
- Take your newly added info, and assign it to another string variable, call it appendText.
- Then, use FSO to OVERWRITE the file with appendText & fileText.
- This way you write the new information first, then write back the previous contents of the file.
1. Read the contents of the old file
2. Open a new file with new name for write
3. Write new contents to the new file
4. Then write the contents of the old file to new file
5. Close the new file and old file
Optionally
6. Delete old file
7. Rename new file to old file
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.