E
Ed
I use a macro which separates a long text file into individual documents.
The macro writes chunks of text to a string, opens a new document through
the FSO, and writes the string to the new doc. I use:
Set docNew = fs.CreateTextFile(strNewDoc)
docNew.Write (strNew)
docNew.Close
"strNewDoc" is a file path, an incremented file name, and the ".doc" file
extension. When I open these through Word or by double-clicking, I get a
File Conversion dialog, asking me to "Select the encoding that makes your
document readable." The "Windows (Default)" encoding works fine and the doc
opens.
With previous versions of this macro, I did originally open a new Word doc,
write the string, and use SaveAs, but when I got up to 14,000 new documents,
the macro would take up to half an hour to finish. Using TextStream works
much faster. Also, I normally open these through an Excel macro (the Word
macro that extracts these new files also writes several data points onto a
spreadsheet), and do not get the file conversion dialog.
Is there anything I can add to my macro code that would convert these files
to Word document format during the macro process so opening with Word is
smoother?
Ed
The macro writes chunks of text to a string, opens a new document through
the FSO, and writes the string to the new doc. I use:
Set docNew = fs.CreateTextFile(strNewDoc)
docNew.Write (strNew)
docNew.Close
"strNewDoc" is a file path, an incremented file name, and the ".doc" file
extension. When I open these through Word or by double-clicking, I get a
File Conversion dialog, asking me to "Select the encoding that makes your
document readable." The "Windows (Default)" encoding works fine and the doc
opens.
With previous versions of this macro, I did originally open a new Word doc,
write the string, and use SaveAs, but when I got up to 14,000 new documents,
the macro would take up to half an hour to finish. Using TextStream works
much faster. Also, I normally open these through an Excel macro (the Word
macro that extracts these new files also writes several data points onto a
spreadsheet), and do not get the file conversion dialog.
Is there anything I can add to my macro code that would convert these files
to Word document format during the macro process so opening with Word is
smoother?
Ed