PDA

View Full Version : Launching a PDF file?



pingwin77
02-03-2010, 12:36 PM
Is there any easy way to launch a .PDF file with out having to first launch Adobe? Our computers have different version of Abode and Adobe Reader so the .exe is in different locations. I am working on a workbook that will be distributed to many users.

Currently I have the folowing code that works, but will only do so on 1 computer.


Private Sub CommandButton2_Click()
Shell "C:\Program Files\Adobe\Acrobat 7.0\Acrobat\Acrobat.exe J:\Company Name\test.pdf", vbMaximizedFocus
' 1st file location launches the program (Acrobat)
' 2nd location launches the file (PDF)
' Change both as needed. Make sure all the computers have the drive mapped the same way.

End Sub

lucas
02-04-2010, 07:35 AM
Try followHyperlink:
Sub OpenPDFdoc()
MsgBox "This will fail if you don't have Adobe Acrobat installed :o)"
On Error GoTo 1
ActiveWorkbook.FollowHyperlink ActiveWorkbook.Path & _
"\AA cover.pdf", NewWindow:=True
' ActiveWorkbook.FollowHyperlink "C:\Temp\AA cover.pdf", NewWindow:=True
Exit Sub
1: MsgBox Err.Description
End Sub