Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

run macro on close & open

3 views
Skip to first unread message

Stu

unread,
Oct 15, 2003, 7:25:16 AM10/15/03
to
How do i get a macro to run when a document is closed or opened?

Cheers
---
Stu

------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/

Tom Ogilvy

unread,
Oct 15, 2003, 7:56:22 AM10/15/03
to
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.

--
Regards,
Tom Ogilvy

"Stu" <Stu....@excelforum-nospam.com> wrote in message
news:Stu....@excelforum-nospam.com...

Chip Pearson

unread,
Oct 15, 2003, 8:46:50 AM10/15/03
to
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 ch...@cpearson.com

"Stu" <Stu....@excelforum-nospam.com> wrote in message
news:Stu....@excelforum-nospam.com...

Tom Ogilvy

unread,
Oct 15, 2003, 9:09:21 AM10/15/03
to
Well that interpretation makes more sense <g>

--
Regards,
Tom Ogilvy

"Chip Pearson" <ch...@cpearson.com> wrote in message
news:Ovagopxk...@TK2MSFTNGP12.phx.gbl...

0 new messages