Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default find from Excel VBA a text file last row


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

--
0000_AAAA_000
-----------------------------------------------------------------------
0000_AAAA_0000's Profile: http://www.excelforum.com/member.php...fo&userid=1248
View this thread: http://www.excelforum.com/showthread.php?threadid=26889

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default find from Excel VBA a text file last row

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

"0000_AAAA_0000" wrote:


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 cells
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 Sub


--
0000_AAAA_0000
------------------------------------------------------------------------
0000_AAAA_0000's Profile: http://www.excelforum.com/member.php...o&userid=12480
View this thread: http://www.excelforum.com/showthread...hreadid=268898


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I find a deleted excel file? Or an autosave file? Aladriel Excel Discussion (Misc queries) 10 January 3rd 08 07:46 PM
clicking .XLS file opens Excel 2003 but doesn't find the file Arrow Computer Excel Discussion (Misc queries) 2 August 10th 05 03:51 AM
How do I find a file/spreadsheet that Excel says is Already open but I can't find it? nwtrader8 Excel Discussion (Misc queries) 5 June 21st 05 02:16 PM
Excel VBA - open text file, replace text, save file? Cybert Excel Programming 2 October 2nd 04 01:05 AM
Doing a find and replace in a text file Nick Lancuba Excel Programming 2 June 23rd 04 02:24 AM


All times are GMT +1. The time now is 03:19 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"