So it looks like, Pages: 39
I would like to run a macro to replace the numbers with a quick part field, NumPages.
I found the below, but since there is only one instance of Pages:, does it need the loop and just not sure how to replace the number with the numpages field.
Code: Select all
Sub FindWord()
Dim rng As Word.Range
Dim SearchString As String
Set rng = ActiveDocument.Content
SearchString = "Pages:"
With rng.Find
Do While .Execute(findText:=SearchString, Forward:=True) = True
rng.MoveEndUntil (" .,;!")
rng.Select
rng.Collapse wdCollapseEnd
Loop
End With
End Sub