saban
06-21-2008, 02:07 PM
this one goes also thrugh footnotes that are not in selection any ideas why
Dim objFtn As Footnote
'Selection.HomeKey wdStory
Dim rngFoot As Footnote
Dim rngTmp As Range
Dim sel As Selection
Set sel = Selection
For Each rngFoot In sel.Footnotes
Set rngTmp = rngFoot.Range
With rngTmp.Find
.ClearFormatting
.Replacement.ClearFormatting
.Text = "^w" ' .Text = " [ ]@([! ])"
.Replacement.Text = " " '.Replacement.Text = " \1"
' .MatchWildcards = True
.Wrap = wdFindStop
.Format = False
.Forward = True
.Execute Replace:=wdReplaceAll
End With
Next rngFoot
Dim objFtn As Footnote
'Selection.HomeKey wdStory
Dim rngFoot As Footnote
Dim rngTmp As Range
Dim sel As Selection
Set sel = Selection
For Each rngFoot In sel.Footnotes
Set rngTmp = rngFoot.Range
With rngTmp.Find
.ClearFormatting
.Replacement.ClearFormatting
.Text = "^w" ' .Text = " [ ]@([! ])"
.Replacement.Text = " " '.Replacement.Text = " \1"
' .MatchWildcards = True
.Wrap = wdFindStop
.Format = False
.Forward = True
.Execute Replace:=wdReplaceAll
End With
Next rngFoot