Open a PDF file with a Combo Box Result

  • As long as the file extension (e.g., "pdf") is associated with a default application (e.g., Adobe Acrobat Reader), then you should be able to use something like this to open the file:

    Sub ShowFile(fName As String)
    Dim ShApp As Object, fso As Object
      Set ShApp = CreateObject("Shell.Application")
      Set fso = CreateObject("Scripting.FileSystemObject")
      If fso.FileExists(fName) Then
        CreateObject("Shell.Application").Open (fName)
        MsgBox "The file (" & fName & ")" & vbCrLf & "does not exist or you do not have permission to read it.", vbOKOnly, "File Not Found"
      End If
    End Sub
  • Hi,

    Change your Private Sub cmdOpen_Click() with this:

    Private Sub cmdOpen_Click()
    Dim sFilePath As String
    sFilePath = "C:\Users\jchan\Documents\My Documents\NHRA\Chassis Inspection Info\Chassis Specs\Chassis Specs" & cboChassisSpec.Text
    ActiveWorkbook.FollowHyperlink Address:=sFilePath

    End Sub

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!