Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Run a macro when a workbook is opened
I know its there somewhere but I cannot find help on how to run a macro
which runs automatically when a workbook is opened and again how to run a macro when a workbook is closed. I can't figure out how to run open and close events! Can anyone get me started? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Run a macro when a workbook is opened
Hi,
Workbook_Open is an "event procedure" and needs to go in the module of the ThisWorkbook object. Alt+F11 to the VB editor In the project explorer window double-click the ThisWorkbook entry under Microsoft Excel Objects. In the code window which should now be showing you the module for ThisWorkbook: - select Workbook from the left hand dropdown at the top of the window - select Open from the right hand dropdown [may have happened automatically] - type your code between the lines Private Sub Workbook_Open() and End Sub which will have been generated automatically. Regards, Jan Karel Pieterse Excel TA/MVP -----Original Message----- I know its there somewhere but I cannot find help on how to run a macro which runs automatically when a workbook is opened and again how to run a macro when a workbook is closed. I can't figure out how to run open and close events! Can anyone get me started? . |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Run a macro when a workbook is opened
Merevyn,
Name the macros Auto_Open and Auto_Close. -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Mervyn Thomas" wrote in message ... I know its there somewhere but I cannot find help on how to run a macro which runs automatically when a workbook is opened and again how to run a macro when a workbook is closed. I can't figure out how to run open and close events! Can anyone get me started? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
open workbook b when workbook a opened | Excel Discussion (Misc queries) | |||
How to stop Excel remembering/loading macro from previously opened Workbook | Excel Discussion (Misc queries) | |||
How to run a macro as soon a a workbook (.xls) is opened? | Excel Worksheet Functions | |||
Workbook copies itself when opened | Excel Worksheet Functions | |||
Can macro/userform run depending on HOW workbook is opened? | Excel Discussion (Misc queries) |