Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I'm sure I'm missing something obvious, but is there a way to make a
macro/vba program run automatically when the workbook is opened? In my case I have a link to data on a server that refreshes on opening the workbook and then must be manipulated. Currently I have a button to click, but I want to avoid user forgetfulness if possible. Thanks Paul |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Paul
If its the same workbook each time you could try putting the following line into the Workbook_Open event procedure of that workbook: Application.Run "MacroName" Hope that helps Andy "Paul Wisken" wrote: I'm sure I'm missing something obvious, but is there a way to make a macro/vba program run automatically when the workbook is opened? In my case I have a link to data on a server that refreshes on opening the workbook and then must be manipulated. Currently I have a button to click, but I want to avoid user forgetfulness if possible. Thanks Paul |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Thanks Andy, Sound simple, but most of that went straight over my head, so it's back to the old VB help now to see what you're talking about. Paul *** Sent via Developersdex http://www.developersdex.com *** |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
section "thisworkbook" in vba manager and then:
Private Sub Workbook_Open() End Sub |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
in a module ...
Sub Auto_Open your code here End Sub As soon as the workbook is open the code in the Auto_Open sub will run |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Good afternoon Paul Wisken Two ways: First call your macro Auto_Open eg: Sub Auto_Open() Second, the above will work but you should really use the even procedures facility. Put the code for your macro in the ThisWorkboo pane within the VBE, rather than the Modules pane and then change th name to Workbook_Open(). Does that make any more sense...? For more information about this have a look he http://www.cpearson.com/excel/events.htm HTH Dominic -- dominic ----------------------------------------------------------------------- dominicb's Profile: http://www.excelforum.com/member.php...fo&userid=1893 View this thread: http://www.excelforum.com/showthread.php?threadid=43660 |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks everyone.
It's now working perfectly Paul *** Sent via Developersdex http://www.developersdex.com *** |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Autorun macro | Excel Discussion (Misc queries) | |||
MACRO AUTORUN | Excel Discussion (Misc queries) | |||
Excel Macro Issue Trying to autorun Macro Upon Opening Worksheet | Excel Programming | |||
Autorun Macro | Excel Programming | |||
Autorun a macro | Excel Programming |