Link to home
Start Free TrialLog in
Avatar of thandel
thandel

asked on

Run macro before closing to prevent prompt to save document

I would like to run a macro before a document is closed.... specifically I don't want Word to ask if they would like to save the document even if they made changes.  I tried

Sub Document_Closed ()
ThisDocument.Saved = True

but I still get prompted to save the document.

What did I do wrong?
ASKER CERTIFIED SOLUTION
Avatar of Colosseo
Colosseo
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of thandel
thandel

ASKER

Thanks, is there a list I can find on the internet for items like this.

I updated your code to this so it simply closes... where it needs to be saved or not.

Sub AutoClose()

    ActiveDocument.Saved = True

End Sub