Running macro upon opening workbook

  • Thread starter Thread starter don
  • Start date Start date
D

don

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 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 said:
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
 
don said:
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 ?
 
How do I save the following in Thisworkbook object.
Looking thru help I only see Thisworkbook discussed as a property.

Thanks
Don
 
Back
Top