I tried and tried but could get it to Selection or ActiveDocument.Content.Find to find keyword, but it doesn't work. Why??
Range worked here below. Question: Does this search for all occurrences of "first"? No way to stop at first occurrence with this method of searching, correct?
Code:
With .Range.Find
'.ClearFormatting
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
'.MatchSoundsLike = False
.MatchAllWordForms = False
.Text = "first"
.Execute 'Replace:=wdReplaceAll
If .Found = True Then
Print #DestFileNum, wdDoc.Name
End If
End With
So I tried to modify, but this didn't find keyword:
Code:
Selection.HomeKey Unit:=wdStory 'what does this do? It starts the search from the start of the document.
With Selection.Find
'.ClearFormatting
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
'.MatchSoundsLike = False
.MatchAllWordForms = False
.Text = "first"
.Execute 'Replace:=wdReplaceAll
If .Found = True Then
Print #DestFileNum, wdDoc.Name
End If
End With
I also tried ActiveDocument.Content.Find, but it didn't find keyword either.
Code:
With ActiveDocument.Content.Find
'.ClearFormatting
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
'.MatchSoundsLike = False
.MatchAllWordForms = False
.Text = "first"
.Execute 'Replace:=wdReplaceAll
If .Found = True Then
Print #DestFileNum, wdDoc.Name
End If
End With