Table of contents
Collapse the table of content
Expand the table of content

Page.PageNumber Property (Publisher)

office 365 dev account|Last Updated: 8/24/2017
3 Contributors

Returns a String that represents the current page number. Read-only.


expression. PageNumber

_expression_A variable that represents a Page object.

Return Value



This example creates a text box, gets the current page number, and inserts it with new text into the new shape.

Sub GetPageNumber() 
 Dim strPageNumber As String 
 With ActiveDocument.Pages(1) 
 strPageNumber = .PageNumber 
 .Shapes.AddTextbox(Orientation:=pbTextOrientationHorizontal, _ 
 Left:=100, Top:=100, Width:=100, Height:=100) _ 
 .TextFrame.TextRange.InsertAfter NewText:="This is page " _ 
 &; strPageNumber &; " of " &; .Parent.Count &; "." 
 End With 
End Sub
© 2018 Microsoft