Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
sba sba is offline
external usenet poster
 
Posts: 1
Default exporting data to the middle of a text file

Is it possible to write excel data to the *middle* of a text file? The
only writing/exporting I can find seems to either append the data to
the end, or overwrite the text file starting at the beginning (erasing
the existing text).

Woudl it work to rewrite the text file into a new name up to the
designated point, append the relevant excel cells at that position,
then continue rewriting the original text file into the new file? Not
sure I'm allowed to have files open for reading and writing at the
same time. And since my text file has 10,000's of lines, seems rather
slow and clunky to have to rewrite that many lines just to add a few
words.

I'm not new to programming, but rather new to excel/VBA. Thanks ahead
of time for any suggestions.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 284
Default exporting data to the middle of a text file

I'd investigate the object, "Scripting.FileSystemObject" that has methods
for opening text files for either reading, writing or appending. You don't
say how you will determine the insertion point so I can't provide too many
specifics. I suspect you will open your text file for reading and assign
the text stream before the break to one string variable and the text stream
after to a second variable and read your workbook cells into a third (or
multiple) variables, close the text file, open it again, this time for
writing and overwrite the previous contents with the content of your string
variables.

Steve Yandl



"sba" wrote in message
...
Is it possible to write excel data to the *middle* of a text file? The
only writing/exporting I can find seems to either append the data to
the end, or overwrite the text file starting at the beginning (erasing
the existing text).

Woudl it work to rewrite the text file into a new name up to the
designated point, append the relevant excel cells at that position,
then continue rewriting the original text file into the new file? Not
sure I'm allowed to have files open for reading and writing at the
same time. And since my text file has 10,000's of lines, seems rather
slow and clunky to have to rewrite that many lines just to add a few
words.

I'm not new to programming, but rather new to excel/VBA. Thanks ahead
of time for any suggestions.



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
VBA for Exporting to Text file santaviga Excel Programming 3 January 18th 08 07:42 PM
Import data from the middle of a text file Caol D Excel Programming 4 August 30th 05 09:17 PM
Possible to insert cell data in the middle of line of text? Bob Smith Excel Worksheet Functions 6 July 29th 05 08:14 PM
Exporting data to text file Excel user via OfficeKB.com Excel Programming 0 June 13th 05 06:36 PM
Exporting Text File Ray Ray[_2_] Excel Programming 1 August 17th 03 03:33 PM


All times are GMT +1. The time now is 08:19 AM.

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"