Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can you run a macro on an event 1

Status
Not open for further replies.

bntwillis

Technical User
Joined
Jan 17, 2004
Messages
5
Location
US
I am a newbie to VBA and need to know if I can have a macro launch from an event. Specifically when a user gets ready to close a document can I somehow automatically have a macro run against that doc before it closes?
 
Yes,

There is a Document_Close event. Look in the VBA Project Explorer and select the ThisDocument Object. The Code window for the Document will be displayed. Select Dooument from the Object dropdown and Close from the Procedure dropdown.

:-)

Skip,

Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top