Word VBA, Get Current Page Number

Using the code below you can get the current page number the cursor is on:

Sub main()
Dim intCurrentLine As Integer
intCurrentLine = _
    Selection.Range.Information(wdActiveEndPageNumber)
MsgBox (intCurrentLine)
End Sub

In the figure below the cursor is located at page 10:

Word VBA, Current Page Number

Result after running the code:

Word VBA, Current Page Number, Result

See also:

If you need assistance with your code, or you are looking for a VBA programmer to hire feel free to contact me. Also please visit my website  www.software-solutions-online.com

Leave a Reply

Your email address will not be published. Required fields are marked *