Word 2003 Error - Cannot close Word, dialog box is open ...

M

Mike

Have a Word VBA app which worked fine in Word 2002 ...

Using Word 2003 (SP2) I get the error message - Error: You cannot close
Microsoft Office Word because a dialog box is open. Click OK, switch to
Word, and then close the dialog box.

Briefly, the Word app displays a user form which gets the location of an
input data file and an output folder. It then opens a Word document, updates
the bookmarks in that document with some info from the input file, saves the
Word document with a new filename in the output folder
and closes that document.

The error occurs when the following line is executed:

Set oCurrDoc =
Documents.Open(FileName:="J:\xxx\MasterReport.doc")
oCurrDoc.Activate

It might be worth mentioning the app runs successfully when I have the
template open in Word before actually invoking it.

Would appreciate any suggestions.

Thanks,
Mike
 
M

Mike

A follow-up:

This error is no longer displayed and template execution continues and runs
successfully to completion when I disable the error trap (On Error Resume
Next) before Documents.Open line ... ????

The output document is written correctly and despite the bogus error msg -
Word never closes.

A very unsatisfying work around!
 

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