Consulting

Results 1 to 2 of 2

Thread: Launching a PDF file?

  1. #1

    Launching a PDF file?

    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

  2. #2
    Moderator VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    Try followHyperlink:
    [vba]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[/vba]
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

Posting Permissions

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