Results 1 to 3 of 3

Thread: Opening a pdf with adobe 4.0 problem

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2002
    Location
    Wisconsin
    Posts
    11

    Opening a pdf with adobe 4.0 problem

    Some of the users I support use adobe 5.0 and others have adobe 4.0. I am trying to shell adobe to open a file through vb6 with the following code:

    for adobe 5.0 users:
    Shell "C:\Program Files\Adobe\Acrobat 5.0\Reader\AcroRd32.exe P:\archives\" & JobNo & "\Plan Rack\Archived Plans\PDF_Files\" & PDFName, vbNormalFocus

    for adobe 4.0 users:
    Shell "C:\Program Files\Adobe\Acrobat 4.0\Reader\AcroRd32.exe P:\archives\" & JobNo & "\Plan Rack\Archived Plans\PDF_Files\" & PDFName, vbNormalFocus

    the adobe 5.0 users this works fine but for the adoe 4.0 users I get errors that say the document does not exist.

    My variables JobNo and PDFName are correct and exist

    I know I can just updgrade everyone to adobe 5.0 but some of my users are not allowing me to upgrade them.

    Does anyone know what I could be doing wrong.

    Thanks for your help

  2. #2
    Guru Aaron Young's Avatar
    Join Date
    Jun 1999
    Location
    Red Wing, MN, USA
    Posts
    2,177
    Use the ShellExecute() API and it will launch any file with it's associated application, i.e.

    In a Standard Module:
    VB Code:
    1. Option Explicit
    2.  
    3. Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
    4.  
    5. Public Sub OpenFile(ByVal sFile As String)
    6.   ShellExecute 0, "OPEN", sFile, "", "", 1
    7. End Sub
    Example Usage:
    VB Code:
    1. Option Explicit
    2.  
    3. Private Sub Command1_Click()
    4.   OpenFile "C:\SomeFile.pdf"
    5. End Sub

  3. #3

    Thread Starter
    New Member
    Join Date
    Jan 2002
    Location
    Wisconsin
    Posts
    11
    thanks that worked great

Posting Permissions

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



Click Here to Expand Forum to Full Width