I typed data in word file (test.docm) and tried running following code. It works by searching data in current word file from where the VBA is running. If I copied this exact search to my code with files it doesn't work if I delete data from the test.docm file. I'm thinking that Selection in my code on first post is searching the test.docm data and not looking in the text files?? However, Range is searching the text files in folder.
Code:
Sub SearchFN()
Dim iCount As Integer
'Always start at the top of the document
Selection.HomeKey Unit:=wdStory
With Selection.Find
.ClearFormatting
.Text = "1"
'.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = True
.Execute
End With
If Selection.Find.Found Then
MsgBox "Found"
End If
End Sub