Amending a text file

  • Thread starter Thread starter DHallam
  • Start date Start date
D

DHallam

Hi Guy's

I am trying to create a small data with customer info from an exce
worksheet. I am currently able to export the information into a tex
file and understand that by using the code "output" it will create
new file or alternatively using the code "append" and it will add th
info to the end of the file.

However....

Can anyone help me with amending the data once in the text file i thin
it is the replace function but have no idea of the code.

Any help would be fantastic

Thanks
Dav
 
You will need to open the file with Random access for Read Write; e.g.
Open "C:\Myfile.txt" for Random Read Write as #1
It needs to be random access so you can read in data, then "skip back" to
re-write that data back to the file. Then use Input# or Get to read the data
from the file; read it in, edit it, and write it back with Write# or Print#
or Put. For details see VBA help files on all these functions and also the
topic "Writing Data to Files."
 
Thanks for your previous reply, unfortunately I am still not able to
solve it however I have now posted a more accurate description of what
it is I believe I require.

Kind Regards
Dave
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top