ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Running macro upon opening workbook (https://www.excelbanter.com/excel-programming/363232-running-macro-upon-opening-workbook.html)

don

Running macro upon opening workbook
 
This routine does not start when the workbook is opened.
Does it have to be saved somewhere other than on a VBA module of the
workbook.


Private Sub WorkbookOpen()
Call MyMacro
End Sub

kassie

Running macro upon opening workbook
 
It is not workbookOpen(), but Workbook_Open()

Private Sub Workbook_Open()

Also, this code should be in the This workbook portion of your VBA - Right
click on the Excell icon in the upper left-hand corner of the screen, select
View Code and insert there.

"don" wrote:

This routine does not start when the workbook is opened.
Does it have to be saved somewhere other than on a VBA module of the
workbook.


Private Sub WorkbookOpen()
Call MyMacro
End Sub


Ivan F Moala[_86_]

Running macro upon opening workbook
 

don Wrote:
This routine does not start when the workbook is opened.
Does it have to be saved somewhere other than on a VBA module of the
workbook.


Private Sub WorkbookOpen()
Call MyMacro
End Sub


it needs to be save in the ThisWorkbook object and NOT a Std Modul

--
Ivan F Moal

-----------------------------------------------------------------------
Ivan F Moala's Profile: http://www.excelforum.com/member.php...nfo&userid=195
View this thread: http://www.excelforum.com/showthread.php?threadid=54823


ikr[_2_]

Running macro upon opening workbook
 
"don" wrote in message
...
This routine does not start when the workbook is opened.
Does it have to be saved somewhere other than on a VBA module of the
workbook.


Private Sub WorkbookOpen()
Call MyMacro
End Sub


As well as the other two replies so far, (and this might be obvious -
apologies if I'm teaching you to suck eggs) but have you (and all your users
if you're not the only user of this wkbk) enabled macros by setting an
appropriate security level via Tools | Macro | Security ?



don

Running macro upon opening workbook
 
How do I save the following in Thisworkbook object.
Looking thru help I only see Thisworkbook discussed as a property.

Thanks
Don


On Sun, 4 Jun 2006 02:34:07 -0500, Ivan F Moala
wrote:


don Wrote:
This routine does not start when the workbook is opened.
Does it have to be saved somewhere other than on a VBA module of the
workbook.


Private Sub WorkbookOpen()
Call MyMacro
End Sub


it needs to be save in the ThisWorkbook object and NOT a Std Module



All times are GMT +1. The time now is 02:23 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com