S
StanC
I'm trying to figure out how to code a "Find" action that replicates using
the "Highlight All Items Found in..." check box to select all find targets
at once. I'll then copy and paste them to a report.
Code fragment I'm using unsuccessfully so far:
Set myDoc = Documents.Open(.FoundFiles(i))
If FirstLoop Then
ClearFindAndReplaceParameters
Selection.Find.ClearFormatting
With Selection.Find
.Text = "\[????????\]"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindStop
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Set LinkSelect = Selection.Find.Execute
Selection.Find.Execute
If LinkSelect = "" Then
Selection.Copy
Windows("TestReport.doc").Activate
Selection.EndKey Unit:=wdStory
Selection.TypeParagraph
Selection.TypeText myDoc.Name & vbCr
Selection.Paste
Selection.TypeParagraph
the "Highlight All Items Found in..." check box to select all find targets
at once. I'll then copy and paste them to a report.
Code fragment I'm using unsuccessfully so far:
Set myDoc = Documents.Open(.FoundFiles(i))
If FirstLoop Then
ClearFindAndReplaceParameters
Selection.Find.ClearFormatting
With Selection.Find
.Text = "\[????????\]"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindStop
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Set LinkSelect = Selection.Find.Execute
Selection.Find.Execute
If LinkSelect = "" Then
Selection.Copy
Windows("TestReport.doc").Activate
Selection.EndKey Unit:=wdStory
Selection.TypeParagraph
Selection.TypeText myDoc.Name & vbCr
Selection.Paste
Selection.TypeParagraph