S
Shimon
Hi Again,
I used a solution from this news group for checking whether a selection was
found.
For some reason, if I do not do the replace unconditionaly 1 time, the loop
never starts. Any ideas?
Shimon
Sub InsertNumLooped()
'Replaces the text " Figure: " with Figure: and a reference number
'in order to build a table of figures .
'
'
'
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = " Figure: "
.Replacement.Text = "Figure: "
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchKashida = False
.MatchDiacritics = False
.MatchAlefHamza = False
.MatchControl = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceOne
Selection.MoveRight Unit:=wdCharacter, Count:=1
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, Text:=
_
"SEQ Figure \*ARABIC", PreserveFormatting:=True
Selection.TypeText Text:=" "
For i = 1 To 50
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = " Figure: "
.Replacement.Text = "Figure: "
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchKashida = False
.MatchDiacritics = False
.MatchAlefHamza = False
.MatchControl = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
If Not .Found Then Exit Sub
End With
Selection.Find.Execute Replace:=wdReplaceOne
Selection.MoveRight Unit:=wdCharacter, Count:=1
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, Text:=
_
"SEQ Figure \*ARABIC", PreserveFormatting:=True
Selection.TypeText Text:=" "
Next i
End Sub
I used a solution from this news group for checking whether a selection was
found.
For some reason, if I do not do the replace unconditionaly 1 time, the loop
never starts. Any ideas?
Shimon
Sub InsertNumLooped()
'Replaces the text " Figure: " with Figure: and a reference number
'in order to build a table of figures .
'
'
'
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = " Figure: "
.Replacement.Text = "Figure: "
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchKashida = False
.MatchDiacritics = False
.MatchAlefHamza = False
.MatchControl = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceOne
Selection.MoveRight Unit:=wdCharacter, Count:=1
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, Text:=
_
"SEQ Figure \*ARABIC", PreserveFormatting:=True
Selection.TypeText Text:=" "
For i = 1 To 50
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = " Figure: "
.Replacement.Text = "Figure: "
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchKashida = False
.MatchDiacritics = False
.MatchAlefHamza = False
.MatchControl = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
If Not .Found Then Exit Sub
End With
Selection.Find.Execute Replace:=wdReplaceOne
Selection.MoveRight Unit:=wdCharacter, Count:=1
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, Text:=
_
"SEQ Figure \*ARABIC", PreserveFormatting:=True
Selection.TypeText Text:=" "
Next i
End Sub