MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Running macros when opening an excel file

Posted by Sean Kiggans on March 14, 2001 12:37 PM

I have the following VB code and wish for it to execute when I open the template it is in:

Sheets("REINPUT").Range("E5") = Application.USERNAME
End Sub

Posted by Dave Hawley on March 14, 2001 12:45 PM

Sean, right click on the sheet picture, top left next to "File" and select "View Code". Paste in this code:

Private Sub Workbook_Open()
Run "UserName"
End Sub


OzGrid Business Applications