D
DBrown
I have been trying to build a search of text in pdf files but the return
value is true even when no text is found. Does anyone see a problem with this
code?
Thanks in advance.
Dim Exch As CAcroApp, AVDoc As CAcroAVDoc
Dim strResult As Long
Set Exch = CreateObject("AcroExch.App")
Set AVDoc = CreateObject("AcroExch.AVDoc")
szText = Me.SearchPDF 'unbound text box for User input
AVDoc.Open CurrentProject.path & "\purchase orders\" & Me.PDFfile, "No Title"
DoEvents
strResult = AVDoc.FindText(szText, False, False, True)
MsgBox strResult, vbOKOnly 'shows -1 even when no match is found
If strResult = True Then
MsgBox ("Found Match")
Else: MsgBox ("No Match found")
End If
AVDoc.Close True
Set Exch = Nothing
Set AVDoc = Nothing
value is true even when no text is found. Does anyone see a problem with this
code?
Thanks in advance.
Dim Exch As CAcroApp, AVDoc As CAcroAVDoc
Dim strResult As Long
Set Exch = CreateObject("AcroExch.App")
Set AVDoc = CreateObject("AcroExch.AVDoc")
szText = Me.SearchPDF 'unbound text box for User input
AVDoc.Open CurrentProject.path & "\purchase orders\" & Me.PDFfile, "No Title"
DoEvents
strResult = AVDoc.FindText(szText, False, False, True)
MsgBox strResult, vbOKOnly 'shows -1 even when no match is found
If strResult = True Then
MsgBox ("Found Match")
Else: MsgBox ("No Match found")
End If
AVDoc.Close True
Set Exch = Nothing
Set AVDoc = Nothing