Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default run macro on close & open

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/

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default run macro on close & open

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" wrote in message
...
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/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default run macro on close & open

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



"Stu" wrote in message
...
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/



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default run macro on close & open

Well that interpretation makes more sense <g

--
Regards,
Tom Ogilvy

"Chip Pearson" wrote in message
...
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



"Stu" wrote in message
...
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/





Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro to open, Update links, save and close workbooks Anton Excel Discussion (Misc queries) 0 January 7th 10 03:18 AM
VBA Project - Open/Close with Macro Danny Excel Worksheet Functions 2 September 7th 07 11:02 PM
Macro to close workbook and re-open new copy Dave Lagergren Excel Discussion (Misc queries) 2 February 28th 07 10:11 PM
Macro to Open, then Close another File HROBERTSON Excel Discussion (Misc queries) 1 January 8th 07 06:41 PM
help with macro to open and close workbooks aneurin Excel Programming 1 September 24th 03 02:14 AM


All times are GMT +1. The time now is 05:37 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"