run macro on close & open

T

Tom Ogilvy

If the macro is in the workbook, the workbook must be open for the macro to
actually run. The true anwer would be specific to the context of how you
are trying to run a macro. For instance, if you assign a macro to the
onaction property of a commandbar button, then when the button is pushed, if
the workbook is closed, excel will open it and run the macro.
 
C

Chip Pearson

Stu,

If you mean to have a macro run when a specific workbook is opened, name
the macros Auto_Open and Auto_Close. If you mean to have a macro run when
any workbook is opened or closed, you need to use application-level events.
See www.cpearson.com/excel/appevent.htm


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com (e-mail address removed)
 
T

Tom Ogilvy

Well that interpretation makes more sense <g>

--
Regards,
Tom Ogilvy

Chip Pearson said:
Stu,

If you mean to have a macro run when a specific workbook is opened, name
the macros Auto_Open and Auto_Close. If you mean to have a macro run when
any workbook is opened or closed, you need to use application-level events.
See www.cpearson.com/excel/appevent.htm


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com (e-mail address removed)
 

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