find from Excel VBA a text file last row

  • Thread starter Thread starter 0000_AAAA_0000
  • Start date Start date
0

0000_AAAA_0000

Hi!

I am trying to export to a text file an excel range.

this text file must be updated every X time so when importing new cell
to the Text file, I dont want to delete the previous data.
I mean

if today

text file's:
1 row= Hello
2Row= hi




and I have to export Bye

my text file's 3row must Bye

text file

1 row= Hello
2Row= hi
3row=Bye



How do i know a Specific text file's last row??


Sub How()
Dim Filename As String
Filename = "C:\windows\desktop\XXX.txt"
Open Filename For Output As #1
Write #1, Data;'data comes from one other source
'Close #1
End Su
 
Change this line : Open Filename For Output As #1
To : Open Filename For Append As #1

Then it will just add the data to the end of the file.

Ryan
 

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