view current page number

setup

for large docs on cloud, especially the ones with numberous tracked changes, it could take quite some time for MS Word to show the page number on the lower left corner. and saving time's what i'm after.

solution

the plan

  1. go to the first character of the selected text.
  2. find out the page number of that location.
  3. pop up a MsgBox to display the info.

programming language & module(s)

  • VBA

file preps

make the doc to be processed the active document, i.e. the one where the cursor currently is in.

variables to customize

none.

the script

vPno
Sub vPno()
Dim selRng As Range
Application.ScreenUpdating = False
Set selRng = Selection.Range
With Selection
If Len(.Text) > 1 Then
.Collapse wdCollapseStart
End If
MsgBox "page #" & .Information(wdActiveEndPageNumber)
End With
selRng.Select
Application.ScreenUpdating = True
End Sub

output

image.png

note to self

none.

Some rights reserved
Except where otherwise noted, content on this page is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International license.