Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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. |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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. |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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. |
#4
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]() "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. |
#5
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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. |
#6
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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. |
#7
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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 |
#8
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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. |
#9
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Macro to open specific document | Excel Discussion (Misc queries) | |||
error when running cut & paste macro | Excel Worksheet Functions | |||
Macro to open files isn't updating correctly | Excel Discussion (Misc queries) | |||
Macro to open workbook and copy and paste values in to orig workbo | Excel Worksheet Functions | |||
Hyperlink to open .dot with a macro | Excel Discussion (Misc queries) |