Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / September 2006

Tip: Looking for answers? Try searching our database.

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

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Mike - 05 Sep 2006 16:24 GMT
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
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.