Find and replace
Find and select text
With Selection.Find
.Forward = True
.Wrap = wdFindStop
.Text = "Text you need to find"
.Execute
End With
Bold the text that you are looking for:
With ActiveDocument.Content.Find
.Text = "The text you are looking for"
.Forward = True
.Execute
If .Found = True Then .Parent.Bold = True
End With
Replace all occurances
With Selection.Find
.ClearFormatting
.Text = "Text you are looking for"
.Replacement.ClearFormatting
.Replacement.Text = "Text you are replacing it with"
.Execute Replace:=wdReplaceAll, Forward:=True, _
Wrap:=wdFindContinue
End With
Look for bold formatting and remove it
With ActiveDocument.Content.Find
.ClearFormatting
.Font.Bold = True
With .Replacement
.ClearFormatting
.Font.Bold = False
End With
.Execute FindText:="", ReplaceWith:="", _
Format:=True, Replace:=wdReplaceAll
End With
With Selection.Find
.Forward = True
.Wrap = wdFindStop
.Text = "Text you need to find"
.Execute
End With
Bold the text that you are looking for:
With ActiveDocument.Content.Find
.Text = "The text you are looking for"
.Forward = True
.Execute
If .Found = True Then .Parent.Bold = True
End With
Replace all occurances
With Selection.Find
.ClearFormatting
.Text = "Text you are looking for"
.Replacement.ClearFormatting
.Replacement.Text = "Text you are replacing it with"
.Execute Replace:=wdReplaceAll, Forward:=True, _
Wrap:=wdFindContinue
End With
Look for bold formatting and remove it
With ActiveDocument.Content.Find
.ClearFormatting
.Font.Bold = True
With .Replacement
.ClearFormatting
.Font.Bold = False
End With
.Execute FindText:="", ReplaceWith:="", _
Format:=True, Replace:=wdReplaceAll
End With
Comments
Post a Comment