PDA

View Full Version : VBA Open pdf multiple program locations



Alexandru
04-20-2023, 05:15 AM
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!

June7
04-20-2023, 10:16 AM
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?