Problems with opening TextStream files

E

Ed from AZ

I run a macro which selects sections of a Word document, then opens a
TextStream file object and pastes in the text. The code I'm using is:

Set docNew = fs.CreateTextFile(strNewDoc)
docNew.Write (strNewFile & vbCr & vbCr & _
"This doc created on " & _
Format(Now, "dd mmm yyyy"))
docNew.Close

(fs is FileStreamObject).

I have another macro in Excel that opens a selected doc created this
way using:

WD.Documents.Open doc

(all variables are set good and the code works).

Occasionally, the File Conversion dialog opens. I know these are not
"real" Word docs, but simply text files with a .doc extension, but
saving each of hundreds of files as Word docs adds an enormous amount
of time to the loop.

Is there anything I might be able to do to these files to prevent the
Conversion dialog from opening? Or is there something I can add to
the Excel code to assist these files in opening without the user
having to mess with this?

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