Hi..
This works.. I haven't really done much at all concerning Word.. but it seems to do the trick..
Change the Filepath and Sheet names to suit..
Private Sub CommandButton1_Click()
Dim x, i As Long, wrnge
' Set Folder to Search
strpath = "D:\Test1\"
' Put all .doc* files found in folder (and subfolders) into an array
x = Split(CreateObject("wscript.shell").exec("cmd /c Dir """ & strpath & "*.doc"" /s/b").stdout.readall, vbCrLf)
' Loop though the array of .xls* files
For i = LBound(x) To UBound(x) - 1
With GetObject(x(i))
'Search for first instance of text, and if true, then do stuff
Set wrnge = .Content
wrnge.Find.Text = Range("A1").Value
If wrnge.Find.Execute Then
Sheets("Sheet1").Range("B" & Sheets("Sheet1").Range("B" & Rows.Count).End(xlUp).Row).Offset(1).Value = x(i)
End If
.Close
End With
Next i
End Sub
Bookmarks