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!
--
Les

Re: Macro not always works by Jezebel

Jezebel
Fri Jul 30 00:25:54 CDT 2004

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" <Les@discussions.microsoft.com> wrote in message
news:4043D7C3-00D5-42E4-B35D-C4287B7CA951@microsoft.com...
> 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!
> --
> Les