Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
VBA for Exporting to Text file | Excel Programming | |||
Import data from the middle of a text file | Excel Programming | |||
Possible to insert cell data in the middle of line of text? | Excel Worksheet Functions | |||
Exporting data to text file | Excel Programming | |||
Exporting Text File | Excel Programming |