I'm using this code to find a string in a file. It works fine as long as the file is NOT a large binary file!! Unfortunately that's exactly what I want to look in. Any ideas what the problem might be/solution.
Thanks in anticipation.
Option Explicit
Dim objRegExpr
Dim FSO, TF, inp
Dim colMatches
Set objRegExpr = New regexp
objRegExpr.Pattern = "ADWmax"
objRegExpr.Global = True
Set FSO=CreateObject("Scripting.FileSystemObject"
Set TF=FSO.OpenTextFile("ADwrite",1) ' 1=ForReading
inp=TF.ReadAll
'Execute the regular expression search
Set colMatches = objRegExpr.Execute(inp)
'Print the # of matches found
Msgbox colMatches.Count & " matches found..."
Set colMatches = Nothing
Set objRegExpr = Nothing
Thanks in anticipation.
Option Explicit
Dim objRegExpr
Dim FSO, TF, inp
Dim colMatches
Set objRegExpr = New regexp
objRegExpr.Pattern = "ADWmax"
objRegExpr.Global = True
Set FSO=CreateObject("Scripting.FileSystemObject"
Set TF=FSO.OpenTextFile("ADwrite",1) ' 1=ForReading
inp=TF.ReadAll
'Execute the regular expression search
Set colMatches = objRegExpr.Execute(inp)
'Print the # of matches found
Msgbox colMatches.Count & " matches found..."
Set colMatches = Nothing
Set objRegExpr = Nothing