Running a macro on excel open...


Posted by Ben Houck on April 11, 2001 5:45 AM

How would a get a macro to start running upon opening access?

Thanks in advance,
Ben

Posted by Dave Hawley on April 11, 2001 5:54 AM


Hi Ben

In version of Excel prior to 97 you would call a macro:

Sub Auto_Open()
Your Code
End Sub

But the prefered method now is to use:

Private Sub Workbook_Open()
Your Code
End Sub

This MUST be placed in the Private module of "ThisWorkbook". You can get there quickly by right clicking on the sheet picture, top left next to "File"

Dave

OzGrid Business Applications



Posted by anon on April 11, 2001 4:34 PM


This will only run your code when the workbook containing the code is opened. To run it when Excel opens(Access was a typo?), put the workbook that has the code in the XLStart folder.