Link to home
Start Free TrialLog in
Avatar of WINAIRMVS
WINAIRMVS

asked on

Run macro when visio closes

I need to run a macro when closing visio, and I can't seem to find the appropriate documentation to get me there.  Any help would be appreciated.
Avatar of oldviking
oldviking
Flag of Germany image

I hope this will bring you a bit further:

http://msdn.microsoft.com/en-us/library/ms427232.aspx
If you are working with a specific file, you can add a "Before Document Close" event.
Enter the VBA editor, find the "This document" section in the project explorer, and select the BeforeDocumentClose event in the dropdown to the far right.
Avatar of WINAIRMVS
WINAIRMVS

ASKER

I added the code to "This Document" which did not act on the closing of the document.
Private Sub BeforeDocumentClose()
 nameofmacroIwanttorun
end

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of oldviking
oldviking
Flag of Germany 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
Answer was what I needed.  There was some extra code that wasn't necessary for what I was looking for, but otherwise great answer!