Search doc and bold select text with VBA

R

Ronnie Hugh

Can someone help me with the VBA code that would allow me
to search multiple text boxes within doc for select text
and then bold the text?

thanks
gh
 
H

Helmut Weber

Hi Ronnie,
not a beginners question, I think!
Have a look at this:
Sub Test555()
Dim oShp As Shape
For Each oShp In ActiveDocument.Shapes
If oShp.Type = msoTextBox Then
With oShp.TextFrame.TextRange.Find
.Text = "f"
.Replacement.Text = "f"
.Replacement.Font.Bold = True
.Execute Replace:=wdReplaceAll
End With
End If
Next
End Sub
 

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