Closing activedocument

J

John

Hi,

We have been using a template for a couple of years without trouble in Word
2000. We've recently upgraded to Word 2003 and the code now produces an
error. The template opens a form which has buttons to execute a mail merge
with some Outlook contacts. It saves the document with a temporary name to
merge the data and print it and then closes the temporary document to go on
to the next person. It uses the lines:
ActiveDocument.PrintOut
ActiveDocument.ActiveWindow.Close SaveChanges:=wdDoNotSaveChanges

Now when it encounters the last line it gives the following error:
You cannot close MS Office Word because a dialog box is open. Click OK,
switch to Word, and then close the dialog box.

It seems to not like the dialog box from the original document being open
when I close the temporary document. Out of interest I opened the same
document on a laptop with Office 2000 and it worked fine again.

Any suggestions please?

John
 
J

John

I am now using

Documents("docname.doc").Close SaveChanges:=wdDoNotSaveChanges

and that seems to work OK.

John
 
Top