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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBA code to append Excel data into the next blank line of a text file

Status
Not open for further replies.

Emmie1

Technical User
Jun 27, 2005
11
US
Hello,
I currently am looking for a way to copy a row of data from an excel spreadsheet into the first blank line of a pre-existing text (CSV) file. I have about 30 remote locations who enter info into an excel form. I have a hidden (load) sheet that gives me the info that I need in the order that I need it. Once the remote locations fill the form out they send their individual form back to me. I have a macro that takes the (load) sheet and creates a .txt file. Instead of creating 30 different .txt files, I would like to write VB code that just appends the new data to the .txt file.

If the .txt file has 4 lines already there, I want the VB code to look at the .txt file and paste the info from excel into line 5.

I'm sure there's a way to do this, I've researched online and browsed through VB example code, and can't find anything. Any light anyone could shed would be very much appreciated!!!

Thanks!
EMMIE


 
You could try something like:

...
...
Open fname For Append As #fnum
...
...
...


Hope this helps.





 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top