Add Method (PageNumbers Collection) Example

This example adds a page number to the primary footer in the first section of the active document.

With ActiveDocument.Sections(1)
    .Footers(wdHeaderFooterPrimary).PageNumbers.Add _
        PageNumberAlignment:= wdAlignPageNumberLeft, _
        FirstPage:= True
End With

This example creates and formats page numbers in the header for the active document.

Set myPgNum = ActiveDocument.Sections(1) _
    .Headers(wdHeaderFooterPrimary) _
    .PageNumbers.Add(PageNumberAlignment:= _
    wdAlignPageNumberCenter, FirstPage:= True)
myPgNum.Select
With Selection.Range
    .Italic = True
    .Bold = True
End With