Nonbreaking space

F

Fuzzhead

I want to find all occurrences of ‘Figure(space)number’ and change it to
‘Figure(Nonbreaking space)Number’ where the number can be 1 to 9.

I have the following but it finds all occurrences of the work "Figure " and
I'm looking for Figure 1, Figure 2 and so on.

Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "Figure "
.Replacement.Text = "Figure^s"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
.Execute Replace:=wdReplaceAll
End With
 
J

Jay Freedman

I want to find all occurrences of ‘Figure(space)number’ and change it to
‘Figure(Nonbreaking space)Number’ where the number can be 1 to 9.

I have the following but it finds all occurrences of the work "Figure " and
I'm looking for Figure 1, Figure 2 and so on.

Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "Figure "
.Replacement.Text = "Figure^s"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
.Execute Replace:=wdReplaceAll
End With

Switch over to using a wildcard search
(http://www.gmayor.com/replace_using_wildcards.htm) with the following changes:

Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "(Figure) ([0-9])" ' <==
.Replacement.Text = "\1^s\2" ' <==
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = True ' <==
.MatchSoundsLike = False
.MatchAllWordForms = False
.Execute Replace:=wdReplaceAll
End With
 
F

Fuzzhead

THANK YOU. That worked.




Jay Freedman said:
I want to find all occurrences of ‘Figure(space)number’ and change it to
‘Figure(Nonbreaking space)Number’ where the number can be 1 to 9.

I have the following but it finds all occurrences of the work "Figure " and
I'm looking for Figure 1, Figure 2 and so on.

Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "Figure "
.Replacement.Text = "Figure^s"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
.Execute Replace:=wdReplaceAll
End With

Switch over to using a wildcard search
(http://www.gmayor.com/replace_using_wildcards.htm) with the following changes:

Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "(Figure) ([0-9])" ' <==
.Replacement.Text = "\1^s\2" ' <==
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = True ' <==
.MatchSoundsLike = False
.MatchAllWordForms = False
.Execute Replace:=wdReplaceAll
End With

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the newsgroup so all may benefit.
 

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