![]() |
How to autoRun macro on WB open
I would like to automatically run a specific maco when the workbook is opened.
I am running XP Pro with Office XP. Thanks for all help. |
How to autoRun macro on WB open
Two ways:
One way: Name your macro "Auto_Open". Another way: Use a Workbook_Open event macro. Please post back if you need more. HTH Otto "OlieH" wrote in message ... I would like to automatically run a specific maco when the workbook is opened. I am running XP Pro with Office XP. Thanks for all help. |
How to autoRun macro on WB open
Private Sub Workbook_Open()
Call YourMacroName End Sub Vaya con Dios, Chuck, CABGx3 "OlieH" wrote: I would like to automatically run a specific maco when the workbook is opened. I am running XP Pro with Office XP. Thanks for all help. |
How to autoRun macro on WB open
"OlieH" wrote: I would like to automatically run a specific maco when the workbook is opened. I am running XP Pro with Office XP. Thanks for all help. Thank you both for the help. Otto, I named the macro as you suggested and it worked fine. I did try the Private sub Workbook_open, but I must have done something wrong, since the macro did not fun. Private Sub Workbook_Open() ans = MsgBox("workbook_open worked") End Sub did not open for me. |
How to autoRun macro on WB open
Hi OlieH.........
Glad you got it sorted for your use.......... BTW, this version works fine if put in the WorkbookModule Private Sub Workbook_Open() MsgBox "Workbook Open, worked" End Sub Vaya con Dios, Chuck, CABGx3 "OlieH" wrote: "OlieH" wrote: I would like to automatically run a specific maco when the workbook is opened. I am running XP Pro with Office XP. Thanks for all help. Thank you both for the help. Otto, I named the macro as you suggested and it worked fine. I did try the Private sub Workbook_open, but I must have done something wrong, since the macro did not fun. Private Sub Workbook_Open() ans = MsgBox("workbook_open worked") End Sub did not open for me. |
How to autoRun macro on WB open
Chuck, thanks for the post. I must be dense, but I created a macro, renamed
it (from macro1) to Private Sub Workbook_Open() msgbox "Workbook opened" Stop End Sub This did not execute when I opened the workbook. I am using the Auto_Open, but I do want to understand your method. THanks again. Olie "CLR" wrote: Hi OlieH......... Glad you got it sorted for your use.......... BTW, this version works fine if put in the WorkbookModule Private Sub Workbook_Open() MsgBox "Workbook Open, worked" End Sub Vaya con Dios, Chuck, CABGx3 "OlieH" wrote: "OlieH" wrote: I would like to automatically run a specific maco when the workbook is opened. I am running XP Pro with Office XP. Thanks for all help. Thank you both for the help. Otto, I named the macro as you suggested and it worked fine. I did try the Private sub Workbook_open, but I must have done something wrong, since the macro did not fun. Private Sub Workbook_Open() ans = MsgBox("workbook_open worked") End Sub did not open for me. |
How to autoRun macro on WB open
Make sure the workbook_Open procedure is in the ThisWorkbook module.
Or leave it in a general module, but name it Auto_Open. OlieH wrote: Chuck, thanks for the post. I must be dense, but I created a macro, renamed it (from macro1) to Private Sub Workbook_Open() msgbox "Workbook opened" Stop End Sub This did not execute when I opened the workbook. I am using the Auto_Open, but I do want to understand your method. THanks again. Olie "CLR" wrote: Hi OlieH......... Glad you got it sorted for your use.......... BTW, this version works fine if put in the WorkbookModule Private Sub Workbook_Open() MsgBox "Workbook Open, worked" End Sub Vaya con Dios, Chuck, CABGx3 "OlieH" wrote: "OlieH" wrote: I would like to automatically run a specific maco when the workbook is opened. I am running XP Pro with Office XP. Thanks for all help. Thank you both for the help. Otto, I named the macro as you suggested and it worked fine. I did try the Private sub Workbook_open, but I must have done something wrong, since the macro did not fun. Private Sub Workbook_Open() ans = MsgBox("workbook_open worked") End Sub did not open for me. -- Dave Peterson |
How to autoRun macro on WB open
It's academic at this point since Otto's suggestion is working for
you......but just to close the loop as you requested,......... for purposes of this method, there is no need to rename the macro.....leave it as Macro1, or whatever unique name you wish, just NOT "Workbook_Open", and this macro is left in a regular module. Then the code to place in the "ThisWorkbook" module is as follows...... Private Sub Workbook_Open() Call Macro1 End Sub Thereby, as the file is opened, this macro triggers and automatically triggers Macro1. You can add lines to run other macros there also if you wish....such as Private Sub Workbook_Open() Call Macro1 Call Macro2 Call Macro3 End Sub hth Vaya con Dios, Chuck, CABGx3 "OlieH" wrote: Chuck, thanks for the post. I must be dense, but I created a macro, renamed it (from macro1) to Private Sub Workbook_Open() msgbox "Workbook opened" Stop End Sub This did not execute when I opened the workbook. I am using the Auto_Open, but I do want to understand your method. THanks again. Olie "CLR" wrote: Hi OlieH......... Glad you got it sorted for your use.......... BTW, this version works fine if put in the WorkbookModule Private Sub Workbook_Open() MsgBox "Workbook Open, worked" End Sub Vaya con Dios, Chuck, CABGx3 "OlieH" wrote: "OlieH" wrote: I would like to automatically run a specific maco when the workbook is opened. I am running XP Pro with Office XP. Thanks for all help. Thank you both for the help. Otto, I named the macro as you suggested and it worked fine. I did try the Private sub Workbook_open, but I must have done something wrong, since the macro did not fun. Private Sub Workbook_Open() ans = MsgBox("workbook_open worked") End Sub did not open for me. |
How to autoRun macro on WB open
You need to put the macro in the workbook's ThisWorkbook code module.
In article , OlieH wrote: Chuck, thanks for the post. I must be dense, but I created a macro, renamed it (from macro1) to Private Sub Workbook_Open() msgbox "Workbook opened" Stop End Sub This did not execute when I opened the workbook. I am using the Auto_Open, but I do want to understand your method. THanks again. Olie |
All times are GMT +1. The time now is 06:12 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com