Consulting

Results 1 to 2 of 2

Thread: VBA Open pdf multiple program locations

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1

    VBA Open pdf multiple program locations

    Hello ,

    I made a macro , for this i need to open pdf with pdf reader , all good .
    Problem: Im working with multiple pc's , i have same program(adobe pdf reader ) on all devices but saved in different locations , i want to update my macro from PC1 for the rest of pc's.
    ex:
    PC1 - C:\Program Files\Adobe\Acrobat DC\Acrobat
    PC2 - D:\Program Files\Adobe\Acrobat DC\Acrobat
    PC3 - C:\Program Files/Files\Adobe\Acrobat DC\Acrobat

    I can t change location for adobe reader .

    I am using this for opening pdf.

    Const locatie_test As String = "C:\Program Files\Adobe\Acrobat DC\Acrobat\Acrobat.exe"
    Shell locatie_test & AdobeCommand & Chr(34) & PDFfile & Chr(34), vbNormal
    Question : Is possible to open a pdf with this program on every pc if i have different locations for adobe reader?

    Thank you for helping!
    Last edited by Aussiebear; 04-20-2023 at 05:25 AM. Reason: Added code tags

  2. #2
    VBAX Mentor
    Joined
    Nov 2022
    Location
    The Great Land
    Posts
    336
    Location
    Seems odd that a program path would include Files folder. Was that forward slash a typo?

    PDF should be opened by whatever program is designated as default for PDF files without having to specify exe location. Example from my Access VBA:
    Dim wsShell As ObjectSet 
    wsShell = CreateObject("WScript.Shell")
    wsShell.Run Chr(34) & Me.tbxLink & Chr(34)
    What app are you running this code in?
    How to attach file: Reading and Posting Messages (vbaexpress.com), click Go Advanced below post edit window. To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •