Adding a page number automatically

H

Hari Prasadh

Hi,

Whenever I print a word document I automatically want to add page numbers to
it, if it doesnt exist already.

basically a before_print event (I have used excel to some extent)

I recorded this macro

Sub Macro1()
Selection.Sections(1).Footers(1).PageNumbers.Add PageNumberAlignment:= _
wdAlignPageNumberRight, FirstPage:=True
End Sub

Please tell me the syntax for before_print and where to store this macro so
that each time I fire a print of any "scratch document" page numbers get
added automatically.( i always forget to add page numbers to my prints)
 
J

Jean-Guy Marcil

Hari Prasadh was telling us:
Hari Prasadh nous racontait que :
Hi,

Whenever I print a word document I automatically want to add page
numbers to it, if it doesnt exist already.

basically a before_print event (I have used excel to some extent)

I recorded this macro

Sub Macro1()
Selection.Sections(1).Footers(1).PageNumbers.Add
PageNumberAlignment:= _ wdAlignPageNumberRight, FirstPage:=True
End Sub

Please tell me the syntax for before_print and where to store this
macro so that each time I fire a print of any "scratch document" page
numbers get added automatically.( i always forget to add page numbers
to my prints)

See fellow MVP Bill Coan's excellent article on the subject:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnword2k2/html/odc_wdappevnt.asp

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 

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