Share via

Selecting Current Page Range

Anonymous
2015-04-07T23:01:17+00:00

I want to do some work (primarily replacing text) on the current physical page.  I presume that I will need to extract and then replace the current page's range.

How is this done?

TIA

Microsoft 365 and Office | Word | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Doug Robbins - MVP - Office Apps and Services 323.1K Reputation points MVP Volunteer Moderator
2015-04-07T23:54:15+00:00

Using VBA,

Dim rngPage as Range

Set rngPage = ActiveDocument.Bookmarks("\page").Range

will set a rngPage to the Range of the page on which the Selection is located.

Then you could use

With rngPage

    .Text = Replace(.Text, "old text to be replaced", "new text to be used")

End With

Was this answer helpful?

0 comments No comments

0 additional answers

Sort by: Most helpful