Link to home
Start Free TrialLog in
Avatar of TimLitle
TimLitle

asked on

How can I write VBA code which is the equivalent to manually double clicking a .pdf file?

I would like to display a .pdf file from VBA code.  The first line of the code below does this.

The VBA code will run on multiple computers which will have various versions of Acrobat and AcroRd32 (the free .pdf reader) installed on them.  Manually double clicking on the file "Test.pdf" will display the file no matter what version of Acrobat or the Reader is installed because the .pdf extension determines the correct program to use.

My question is: what is the VBA code to display the "Test.pdf" file on all such computers?  I want the .pdf extension to tell the computer what program to use rather than specify it in the Shell statement.  The second line of code doesn't work.
Shell "C:\Program Files\Adobe\Acrobat 9.0\Acrobat\Acrobat.exe C:\Test.pdf", vbNormalFocus
 
Shell "C:\Test.pdf", vbNormalFocus

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of RapidDelp
RapidDelp

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of TimLitle
TimLitle

ASKER

Thanks -- this was exactly what I was looking for.