Macro not always works

L

Les

I have a macro in a Word document, which works okay except that the last 2 lines sometimes execute and sometimes don't.
They are
ActiveDocument.Save
ActiveDocument.Close
What might the reason for this be, since the rest of the macro always works!
 
J

Jezebel

Word sometimes gets a little confused about whether or not the document is
saved.

Save does nothing if .Saved = TRUE (Word thinks the document is saved
already). However sometimes Close still thinks the document DOES need
saving, so it fails too.

One solution is:

ActiveDocument.Saved = FALSE
ActiveDocument.Save
ActiveDocument.Close SaveChanges:=FALSE







Les said:
I have a macro in a Word document, which works okay except that the last 2
lines sometimes execute and sometimes don't.
 

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