Print Excel Workbook When Open

J

John Wilson

Paul,

Two ways.......
One...
Create a sub in a regular module named Auto_Open
e.g.
Sub Auto_Open()
' your code here or call another sub
End Sub

or in the Workbook_Open Event
Double Click on "ThisWorkbook" in the "Projects" Window
Copy and paste the following

Private Sub Workbook_Open()
' your code here or call another sub
End Sub

John
 
T

Tom Ogilvy

open the workbook, go to the VBE (Alt+F11), in the project explorer, click
on the project, then right click on the ThisWorkbook entry for that
workbook. Select view code. In the resulting code module, in the left
dropdown at the top, select workbook, and at the right dropdown select open.
At any point, the sub

Private Sub Workbook_Open()

End Sub

will appear in the module. When it does, call your macro from there

Private Sub Workbook_Open()

MyMacro

End Sub

That fires whenever a workbook is opened as long as events are enables.

Read about events at Chip Peasons site

http://www.cpearson.com/excel/event.htm
 
P

Paul Scott

Got it to work. Thanks for the help.

-----Original Message-----
Paul,

Two ways.......
One...
Create a sub in a regular module named Auto_Open
e.g.
Sub Auto_Open()
' your code here or call another sub
End Sub

or in the Workbook_Open Event
Double Click on "ThisWorkbook" in the "Projects" Window
Copy and paste the following

Private Sub Workbook_Open()
' your code here or call another sub
End Sub

John



.
 
P

Paul Scott

I got it to work. Thanks for the help.

-----Original Message-----
open the workbook, go to the VBE (Alt+F11), in the project explorer, click
on the project, then right click on the ThisWorkbook entry for that
workbook. Select view code. In the resulting code module, in the left
dropdown at the top, select workbook, and at the right dropdown select open.
At any point, the sub

Private Sub Workbook_Open()

End Sub

will appear in the module. When it does, call your macro from there

Private Sub Workbook_Open()

MyMacro

End Sub

That fires whenever a workbook is opened as long as events are enables.

Read about events at Chip Peasons site

http://www.cpearson.com/excel/event.htm



--
Regards,
Tom Ogilvy



.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top