PDA

View Full Version : [SOLVED:] Entering identical text strings into multiple locations within a document



Jfp87
07-11-2014, 12:38 AM
Hi guys,

New to VBA & would appreciate some advice...

I am trying to enter a piece of text into a document at multiple locations. So far, I have tried coding it two seperate ways, both of which I feel aren't ideal.

Method 1:
Using bookmarks - This worked great to a point; but as far as I am aware, bookmarks are only used to mark unique locations which meant each occurence of the given text required a different bookmark name. I might be mistaken, but if this is the case then this method is too inefficient.

Method 2:
Using a hidden character symbol to mark locations throughout the document - I then tried to perform a 'find & replace'; searching for the hidden symbol & replacing it with my given text string. I found this more difficult to code, especially trying to replace the hidden symbol with 'normal' visible text.

I can't help thinking there is a better way to accomplish this...I just dont know it lol.

Is there anything similar to a bookmark that can be used to mark multiple locations within a document but doesn't require a unique name for each location?

Your help is appreciated,
Joe

macropod
07-11-2014, 06:28 AM
See: http://gregmaxey.mvps.org/word_tip_pages/repeating_data.html