bcn
07-02-2013, 05:01 AM
Hi,
I'm running this code without success:
Sub RemoveCaptionFields()
With ActiveDocument.Content.Find
.ClearFormatting
.Replacement.ClearFormatting
.text = "Figure ^d STYLEREF 1 \s ^21-^d SEQ Figure \* ARABIC \s 1 ^21: "
.Replacement.text = ""
.Forward = True
.Wrap = wdFindContinue
.format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
.Execute Replace:=wdReplaceAll
End With
End Sub
What I'm trying to do is remove all the "Figure { chapter number }-{ page number }: " in the figure captions of a document.
The funny thing is that if I use Word's Search and Replace function to look for that string, it finds it. But if I click "Replace all" (using an empty Replace field), it says it could not find a single occurrence of the string.
Any help will be highly appreciated!
Daniel
I'm running this code without success:
Sub RemoveCaptionFields()
With ActiveDocument.Content.Find
.ClearFormatting
.Replacement.ClearFormatting
.text = "Figure ^d STYLEREF 1 \s ^21-^d SEQ Figure \* ARABIC \s 1 ^21: "
.Replacement.text = ""
.Forward = True
.Wrap = wdFindContinue
.format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
.Execute Replace:=wdReplaceAll
End With
End Sub
What I'm trying to do is remove all the "Figure { chapter number }-{ page number }: " in the figure captions of a document.
The funny thing is that if I use Word's Search and Replace function to look for that string, it finds it. But if I click "Replace all" (using an empty Replace field), it says it could not find a single occurrence of the string.
Any help will be highly appreciated!
Daniel