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
Mike - 05 Sep 2006 21:53 GMT
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!
> Have a Word VBA app which worked fine in Word 2002 ...
>
[quoted text clipped - 21 lines]
> Thanks,
> Mike