Find text, replace with graphic

K

Karen G

I have a large doc generated from a database. The doc
has been pasted into Word 2003. Now, I need to key off
of an indicator tag (text) and replace all occurrences
(several hundred) of that tag with the same tiny graphic
image.

I've found no way to do that -- can anyone help me? I
even thought I might be able to define the image as a
symbol and do a search-and-replace based on that, but I
find no docs on adding a symbol.

I do have the Office suite available to me if there's a
better way to do this in something else.

This is a process that we'll have to do several times per
year, so it needs to be repeatable and take as little
time as possible... a global search-replace would be
ideal!

Many thanks for any help you can give,

Karen
 
D

Doug Robbins - Word MVP

Use a macro containing the following code where your replace [insert the tag
here] with whatever your tag is and the path\filename of the graphic for
that shown.

Selection.HomeKey wdStory
Selection.Find.ClearFormatting
With Selection.Find
Do While .Execute(FindText:="[insert the tag here]",
MatchWildcards:=False, Wrap:=wdFindStop, Forward:=True) = True
Selection.Range.Delete
Selection.Range.InlineShapes.AddPicture "C:\Documents and
Settings\Doug\My Documents\My Pictures\P6220074.jpg"
Loop
End With


--
Please post any further questions or followup to the newsgroups for the
benefit of others who may be interested. Unsolicited questions forwarded
directly to me will only be answered on a paid consulting basis.

Hope this helps
Doug Robbins - Word MVP
 
Top