Code to search and not re-open PDF using form criteria (1 Viewer)

matt beamish

Registered User.
Local time
Today, 14:00
Joined
Sep 21, 2000
Messages
208
With other folks help, I have this code to run on an On Click Event on a Form

Code:
Private Sub Lettertxt_Click()

    Dim strPath As String
    Dim Searchmem As String
    
    strPath = [Filelocation]
    Searchmem = [MemID]
                
    pat1 = Chr(34) & "C:\Program Files (x86)\Adobe\Reader 11.0\Reader\AcroRd32.exe" & Chr(34)
    pat2 = "/A " & Chr(34) & "search=" & Searchmem & Chr(34)
    pat3 = strPath
    
    Debug.Print pat1 & "; " & pat2 & "; " & pat3
    Shell pat1 & " " & pat2 & " " & pat3, vbNormalFocus
    End Sub

I would like to be able to use my form to search the PDF on the fly but if my PDF is already open, the event cannot be re-run. So I think I need the code to either close the PDF if it is open already, and re-open using the search term (which would be OK but not at all efficient in a workflow), or add in a section that generates a new search within the already open PDF.

The alternative if for the User to search the PDF separately.
Thanks in advance
 

Users who are viewing this thread

Top Bottom