Converting TextStream doc to Word format?

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
 
D

Doug Robbins - Word MVP

If you were opening the new document to write to it, then you could append
the wdFormatDocument attribute to the .SaveAs command, but that is probably
going to run you up against the time barrier again.

Under Tools>Options>General, is the "Confirm conversion at Open" box
checked? If it is, try unchecking it and the dialog may not then appear.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
E

Ed

Thanks for responding, Doug. The "Confirm conversion" is not checked.
(Also, I'm using Word 2002.)
Ed
 

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

Top