I have a Word document for which I'm making some macros. The document contains various arbitrary phrases and words that my macro is supposed to manipulate. An example document may look like the following:
Buy this pie for three dollars|two euros
This pie only costs $3|€2.
In this document, my macro needs to locate the phrase "three dollars|two euros" and "$3|€2" and manipulate them in certain ways. I cannot change the text or it's appearance.
I could add a bookmark with a common prefix to each of the phrases, but since they have to be unique, it would have to be "taggedPhraseBkmrk_1", "taggedPhraseBkmrk_2" ..., which isn't ideal to maintain.
Alternatively, I could create a style, for example "taggedPhraseStyle", assign this style to all the phrases, and in the macro just find all phrases with that text. The problem with this is the fact that it changes the look, e.g. all the phrases get the same font-weight. Now, if for example the bold "three dollars|two euros" phrase becomes non-bold when I apply the taggedPhraseStyle style, I can re-bolden it afterwards (so that its style becomes "taggedPhraseStyle + bold"), but this is also a bit of a hassle.
Are there any other approaches to "invisibly" tagging words or phrases in Word, so that a macro can easily find and iterate over them?