Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 39
Default 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.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,090
Default 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.



  #3   Report Post  
Posted to microsoft.public.excel.misc
CLR CLR is offline
external usenet poster
 
Posts: 1,998
Default 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.

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 39
Default 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.

  #5   Report Post  
Posted to microsoft.public.excel.misc
CLR CLR is offline
external usenet poster
 
Posts: 1,998
Default 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.



  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 39
Default 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.

  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default 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
  #8   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 4,624
Default 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

  #9   Report Post  
Posted to microsoft.public.excel.misc
CLR CLR is offline
external usenet poster
 
Posts: 1,998
Default 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.

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 specific document Thew21 Excel Discussion (Misc queries) 1 December 13th 06 01:18 PM
error when running cut & paste macro Otto Moehrbach Excel Worksheet Functions 4 August 9th 06 01:49 PM
Macro to open files isn't updating correctly telewats Excel Discussion (Misc queries) 2 February 21st 06 09:04 PM
Macro to open workbook and copy and paste values in to orig workbo Dena X Excel Worksheet Functions 1 December 15th 05 11:13 PM
Hyperlink to open .dot with a macro scottEfraz Excel Discussion (Misc queries) 1 November 16th 05 11:07 PM


All times are GMT +1. The time now is 11:34 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"