Running a Macro on Open in Word

Ste_Moore01

Active Member
Joined
Jul 13, 2005
Messages
467
Hi everyone,

I'm trying to run a macro when a document is opened in Word and I've found that it's a little different than Excel.

In Excel you would put something like..
Code:
Private Sub Workbook_Open()
    Sheets("MAIN").Select
End Sub

But in Word it doesn't use workbooks so I'm confused.

I'm trying to print the document automatically as soon as the document is opened.

The printer is called "Zetafax Printer" and I would like it to print 1 copy as soon as the document is opened.

Can anybody help me out?
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
I have not really worked with Word macros much, but Word also has a macro recorder. I believe you should be able to get the code for printing by using it.

Making it run automatically, though...let's see. Looks like you just use
Code:
Private Sub Document_Open()

Just make sure you're putting it in the ThisDocument module for your project--NOT the project named Normal (that is the default blank worksheet that opens when you start Word).
 
Upvote 0

Forum statistics

Threads
1,224,872
Messages
6,181,500
Members
453,047
Latest member
charlie_odd

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top