How Does One Add a Page Number to a Header?

S

StevenM

I would like to create a header so that: “Add Title Here†appears on the left
side of the page, and “Page {PAGE}†appears on the right side of the page. So
far I got:

Sub AddHeader()
Dim oRange As Range

Set oRange = ActiveDocument.Range(Start:=ActiveDocument.Range.Start,
End:=ActiveDocument.Range.End)
With oRange.Sections(1).Headers(wdHeaderFooterPrimary).Range
..Delete
..Paragraphs.Alignment = wdAlignParagraphLeft
..InsertAfter "Add Title Here" & vbTab & vbTab & "Page "
End With
End Sub

I would like a page number to follow: "Page ", I wish I could just add: &
vbPageNumber, but I suspect that it will be more complex than that.

Any help will be greatly appreciated.

Steven Craig Miller
 

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