I am building an script that searches multiple string in all files on a directory. It's working when my string doesn't contains spaces. If there's a space on that, the script seaches each word at a time (LOGICAL OR). Due to the amount of files, I can't open them as file text, so I call Excel COM as indicated below. It seems that .matchTextExactly is not working on VBS. Someone has any clues about it?
'=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
' EXCEL FILES
'=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
'
Set openfile = Fsys.OpenTextFile("c:\excelfileswordlist.txt",1,0)
Do While openfile.AtEndOfStream = false
strSentence=openfile.Readline
Set oXL = WScript.CreateObject("Excel.Application"
With oXL.Application.FileSearch
.NewSearch
.MatchTextExactly = TRUE
.TextorProperty = strSentence
.LookIn = "C:\My documents"
.SearchSubfolders = true
.filename = "*.xls"
If .Execute()>0 Then
For i = 1 To .foundfiles.count
results.writeline (.foundfiles(i) & " , " & strSentence)
Next
Else
MsgBox "string not found"
End If
End With
oXl.Quit
Loop
'=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
' EXCEL FILES
'=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
'
Set openfile = Fsys.OpenTextFile("c:\excelfileswordlist.txt",1,0)
Do While openfile.AtEndOfStream = false
strSentence=openfile.Readline
Set oXL = WScript.CreateObject("Excel.Application"

With oXL.Application.FileSearch
.NewSearch
.MatchTextExactly = TRUE
.TextorProperty = strSentence
.LookIn = "C:\My documents"
.SearchSubfolders = true
.filename = "*.xls"
If .Execute()>0 Then
For i = 1 To .foundfiles.count
results.writeline (.foundfiles(i) & " , " & strSentence)
Next
Else
MsgBox "string not found"
End If
End With
oXl.Quit
Loop