Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Having a macro run upon opening a file 1

Status
Not open for further replies.

drm184

MIS
May 25, 2001
35
US
Can anyone tell me how, if it's possible, to have a macro automatically run as soon as you open the file? Is there a VB command I need to write? Thanks for the help.
 
it Alt+F11. Hit F7. In the left hand side of the VBE, there is a pane titled project_Something. Double click on ThiswWorkbook. Choose Open from the drop down box.

Private Sub Workbook_Open()
'your code here
End Sub
Tyrone Lumley
augerinn@gte.net
 
You can also put the Auto_Open macro in your main module. There is also an Auto_Close macro you can use to run code upon closing the workbook.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top