Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi.
How can I make my code run as soon as the .xls document is opened? Thanks in advance. EmilH. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
2 ways. One is with and event. See Chip Pearsons site for more info.
http://www.cpearson.com/excel/events.htm The very simple way is to name the procedure as this:- Sub Auto_Open() and it will run automatically evary time you open the workbook. Sub Auto_Close() runs on closing the workbook. Regards, OssieMac "EmilH" wrote: Hi. How can I make my code run as soon as the .xls document is opened? Thanks in advance. EmilH. |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi E,
Try something like: '============= Private Sub Workbook_Open() Call MyMacro End Sub '<<============= This is workbook event code and should be pasted into the workbook's ThisWorkbook module *not* a standard module or a sheet module: Right-click the Excel icon on the worksheet (or the icon to the left of the File menu if your workbook is maximised) Select 'View Code' from the menu and paste the code. Alt-F11 to return to Excel. --- Regards, Norman "EmilH" wrote in message ... Hi. How can I make my code run as soon as the .xls document is opened? Thanks in advance. EmilH. |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Don't know if this is the best way possible but it's worked for me.
In the VB editor select This Workbook in the VBA Project list, then in the project window change (General) to Workbook. It should give the following Private Sub Workbook_Open() End Sub now insert location.macro name Private Sub Workbook_Open() Module1.mymacro End Sub -- Message posted via http://www.officekb.com |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks a lot!
"Norman Jones" wrote in message ... Hi E, Try something like: '============= Private Sub Workbook_Open() Call MyMacro End Sub '<<============= This is workbook event code and should be pasted into the workbook's ThisWorkbook module *not* a standard module or a sheet module: Right-click the Excel icon on the worksheet (or the icon to the left of the File menu if your workbook is maximised) Select 'View Code' from the menu and paste the code. Alt-F11 to return to Excel. --- Regards, Norman "EmilH" wrote in message ... Hi. How can I make my code run as soon as the .xls document is opened? Thanks in advance. EmilH. |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks a lot!
"blackbox via OfficeKB.com" <u20390@uwe wrote in message news:733bf3f2ae14e@uwe... Don't know if this is the best way possible but it's worked for me. In the VB editor select This Workbook in the VBA Project list, then in the project window change (General) to Workbook. It should give the following Private Sub Workbook_Open() End Sub now insert location.macro name Private Sub Workbook_Open() Module1.mymacro End Sub -- Message posted via http://www.officekb.com |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks a lot!
Just a little note: Auto_Open() didn't work but Workbook_Open() did. "OssieMac" wrote in message ... 2 ways. One is with and event. See Chip Pearsons site for more info. http://www.cpearson.com/excel/events.htm The very simple way is to name the procedure as this:- Sub Auto_Open() and it will run automatically evary time you open the workbook. Sub Auto_Close() runs on closing the workbook. Regards, OssieMac "EmilH" wrote: Hi. How can I make my code run as soon as the .xls document is opened? Thanks in advance. EmilH. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Autorun.inf | Excel Programming | |||
Autorun a macro | Excel Programming | |||
Autorun Add-In | Excel Programming | |||
Autorun Macro | Excel Programming | |||
Autorun a macro | Excel Programming |