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

Page.PageNumber Property (Publisher)

office 365 dev account|Last Updated: 6/12/2017
|
1 Contributor

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

Syntax

expression. PageNumber

_expression_A variable that represents a Page object.

Return Value

String

Example

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
© 2017 Microsoft