R
Ralf999
I am using a macro that helps very good to search and replace multiple
words. The information which word to replace with wich other word is
taken from another file (sr.doc). But the search/replace function only
works for the text-body and not for the footnotes. Can anybody tell me
how to modify the vba below to include the footnotes in the
search/replace macro?
Sub MultiSuchenErsetzen()
'
'
'
'
Dim WordList As Document
Dim Source As Document
Dim i As Integer
Dim Find As Range
Dim Replace As Range
Set Source = ActiveDocument
Set WordList = Documents.Open(FileName:="C:\SR.doc")
Source.Activate
For i = 2 To WordList.Tables(1).Rows.Count
Set Find = WordList.Tables(1).Cell(i, 1).Range
Find.End = Find.End - 1
Set Replace = WordList.Tables(1).Cell(i, 2).Range
Replace.End = Replace.End - 1
Selection.HomeKey Unit:=wdStory
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = Find
.Replacement.Text = Replace
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = True
.MatchByte = False
.CorrectHangulEndings = True
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = False
.MatchFuzzy = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
Next i
words. The information which word to replace with wich other word is
taken from another file (sr.doc). But the search/replace function only
works for the text-body and not for the footnotes. Can anybody tell me
how to modify the vba below to include the footnotes in the
search/replace macro?
Sub MultiSuchenErsetzen()
'
'
'
'
Dim WordList As Document
Dim Source As Document
Dim i As Integer
Dim Find As Range
Dim Replace As Range
Set Source = ActiveDocument
Set WordList = Documents.Open(FileName:="C:\SR.doc")
Source.Activate
For i = 2 To WordList.Tables(1).Rows.Count
Set Find = WordList.Tables(1).Cell(i, 1).Range
Find.End = Find.End - 1
Set Replace = WordList.Tables(1).Cell(i, 2).Range
Replace.End = Replace.End - 1
Selection.HomeKey Unit:=wdStory
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = Find
.Replacement.Text = Replace
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = True
.MatchByte = False
.CorrectHangulEndings = True
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = False
.MatchFuzzy = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
Next i