Results 1 to 3 of 3

Opening pdf from vba script upgraded to adobe acrobat 8.0

  1. #1
    nick243 is offline Competent Performer
    Windows 7 64bit Access 2002
    Join Date
    May 2016
    Posts
    179

    Post Opening pdf from vba script upgraded to adobe acrobat 8.0

    We upgraded our adobe acrobat on a computer at work. I added in the new file path to the new exe file. When we go to run the double click event, it opens the new adobe but brings up error file cannot be found. This script has been up and running for a while. Anybody know of any issues in this script or is it just an adobe issue. This pdf file is over a network.

    Code:
    Private Sub PO_DblClick(Cancel As Integer)
    POV = Me!PO
    
    
    If Len(POV) = 2 Then POV = "0000" & POV
    If Len(POV) = 3 Then POV = "000" & POV
    If Len(POV) = 4 Then POV = "00" & POV
    If Len(POV) = 5 Then POV = "0" & POV
    
    
    If IsNull(Me![ID]) = True Then
       End
    End If
    
    
    idVar = DLookup("ID", "PO-Details", "Sheet1ID = " & Me![ID])
    If IsNull(idVar) = True Then
        strfile = Dir("C:\PackingLists\" & POV & ".pdf")
        If Len(strfile) > 0 Then
            If IsNull(DLookup("PO", "PO-List", "PO = " & Me!PO)) = True Then
                MsgBox "PO " & POV & " does not exsist in system.  Can NOT open size/color form"
                End
            Else
                FileCopy "C:\PackingLists\" & POV & ".pdf", "K:\Teams and Projects\Receiving\PackingLists\PL-" & Me!PO & "-" & Me![ID] & ".pdf"
                Kill "C:\PackingLists\" & POV & ".pdf"
                DoCmd.SetWarnings False
                DoCmd.RunSQL "INSERT INTO [PO-Details] ( Sheet1ID, PO, SZ1, SZ2, SZ3, SZ4, SZ5, SZ6, SZ7, SZ8, SZ9, SZ10 ) SELECT " & Me!ID & " AS Sheet1ID, [PO-List].PO, [PO-List].SZ1, [PO-List].SZ2, [PO-List].SZ3, [PO-List].SZ4, [PO-List].SZ5, [PO-List].SZ6, [PO-List].SZ7, [PO-List].SZ8, [PO-List].SZ9, [PO-List].SZ10 FROM [PO-List] WHERE ((([PO-List].PO)=" & Me!PO & "));"
                DoCmd.OpenQuery "PackingList-AddCCDetails-CommonCarrier"
                DoCmd.SetWarnings True
            End If
        Else
            MsgBox "PO " & Me![PO] & " does not have a packing list is not on file."
            End
        End If
    End If
        
    DoCmd.SetWarnings False
    DoCmd.OpenQuery "PackingList-CaptureUnitsOrdered-CommonCarrier"
    DoCmd.SetWarnings True
      
    DoCmd.OpenForm "X-Ab-CCEntry-Main", , , "Sheet1ID = " & Me![ID]
        
    idVar = Me!ID
    poVar = Me!PO
    folder = "K:\Teams and Projects\Receiving\PackingLists\"
    
    
    If Len(poVar) = 2 Then poVar = "0000" & poVar
    If Len(poVar) = 3 Then poVar = "000" & poVar
    If Len(poVar) = 4 Then poVar = "00" & poVar
    If Len(poVar) = 5 Then poVar = "0" & poVar
    
    
    
    
    sPath = folder & "PL-" & poVar & "-" & idVar & ".pdf"
           
           
    ChDir ("K:\Teams and Projects\Receiving\PackingLists")
    strfile = Dir("K:\Teams and Projects\Receiving\PackingLists\PL-" & poVar & "-" & idVar & ".pdf")
           
    If Len(strfile) > 0 Then
        If FileOrDirExists("C:\Program Files\Adobe\Reader 9.0\Reader\AcroRd32.exe") Then
            path = "C:\Program Files\Adobe\Reader 9.0\Reader\AcroRd32.exe"
        End If
        If FileOrDirExists("C:\Program Files\Adobe\Reader 8.0\Reader\AcroRd32.exe") Then
            path = "C:\Program Files\Adobe\Reader 8.0\Reader\AcroRd32.exe"
        End If
        If FileOrDirExists("C:\Program Files\Adobe\Acrobat 6.0\Acrobat\Acrobat.exe") Then
            path = "C:\Program Files\Adobe\Acrobat 6.0\Acrobat\Acrobat.exe"
        End If
        If FileOrDirExists("C:\Program Files\Adobe\Reader 11.0\Reader\AcroRd32.exe") Then
            path = "C:\Program Files\Adobe\Reader 11.0\Reader\AcroRd32.exe"
        End If
        If FileOrDirExists("C:\Program Files\Adobe\Acrobat 8.0\Acrobat\Acrobat.exe") Then
            path = "C:\Program Files\Adobe\Acrobat 8.0\Acrobat\Acrobat.exe"
        End If
        X = Shell(path & " " & sPath, vbNormalFocus)
    End If
    
    
    End Sub
    Thanks,
    Nick

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    48,359
    Instead of specifying the application, could try FollowHyperlink to open PDF and let it open under app set as default for that file type.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    nick243 is offline Competent Performer
    Windows 7 64bit Access 2002
    Join Date
    May 2016
    Posts
    179
    Quote Originally Posted by June7 View Post
    Instead of specifying the application, could try FollowHyperlink to open PDF and let it open under app set as default for that file type.
    Thank you so much this worked like a charm. I deleted the specifying application and added in Application.FollowHyperlink sPath, ,True

    It has worked great.

    Thanks Nick

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 1
    Last Post: 10-22-2017, 08:08 AM
  2. Replies: 2
    Last Post: 04-12-2017, 08:43 AM
  3. Replies: 4
    Last Post: 10-04-2015, 02:04 PM
  4. Replies: 1
    Last Post: 04-18-2014, 10:03 AM
  5. Replies: 5
    Last Post: 01-23-2014, 09:36 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Tech Forums: Microsoft Office Forums