I can't get Replaceall function to replace text in the text boxes under VBA script

S

Stephen Harding

I am relatively new to vba scripting, but have most of it happening well. I
do have some word doccuments that have both text boxes and normal writing
and I am trying to replace text in both of them. What I am finding is that
if I do the replaceall manually, it gets the lot(even header & footer) but
when I program it into vba it only replaces the ones in the main body. I
managed to figure a workaround for the header & footer, but can't seem to
get it happening for the text boxes(or wordart).

Has anyone got any suggestions?

Here is the code I am using for the replaceall function.
Selection.Find.ClearFormatting
With Selection.Find
.Text = "&&&"
.Replacement.Text = setnum
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll

Thank you. Steve Harding
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top