Jump to content
Lipko

MS Word Find Text Position

Recommended Posts

Hi again!

I'm having a hard time to get the position of a found text in a Word file. I'm able to use the Report Generation toolkit to search+replace text, but I want to highlight the replaced text one way or another. Using the "track changes" option of MS Word would be the best, but changing the font of the replacement and leaving the original text too would also suffice.

The reason I'm struggling with it is that there are several text to search for and replace and the texts are sometimes contain other search text (so for example I want to replace X01 with Y but X01.01 with Z). This can be solved by sorting the search texts reversed alphabetically.

Since I can only search and replace, I have to turn off Track Changes (because the original text will be found again), and replace the found text with a trackable unique dummy text first, than I have to search and replace those with the original+final texts. This means Track Changes will not be effective (or the user would see the horrid dummy texts too). So I would at least apply a different font to the replacements, but I don't know how to set the "Format" parameter of the Document>Range>Find>Execute method.


A preferred method would be to get found ranges first, exclude found ranges from the next searches, then delete the ranges+insert the search string in place of them. This way the changes of the document would have a very nice highlight.

 

Thanks for any hints or better approaches in advance!

 

 

Share this post


Link to post
Share on other sites

I'm not entirely certain what your use case is, but I have found that Bookmarks in Word and Named Ranges in Excel are useful with the RGT for updating fields in a template. Especially when provided a report by the customer rather than being able to design our own.

Write to Bookmarks.png

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.