Results 1 to 2 of 2

Thread: Opening external file and program

  1. #1

    Thread Starter
    Member
    Join Date
    Dec 2007
    Posts
    32

    Opening external file and program

    Hi I have a simple request. I would like to place a button or link on one of my forms that would allow the user to pull up an external file. For instance I have a database of chemicals. The program lets the user search for chemicals. I would like to also place a button or link the person could use to go to the actual label. Either pull it up as a pdf, word, internet link ect..

    Thanks for all the help you have given me!

  2. #2
    Lively Member Spetnik's Avatar
    Join Date
    Jan 2002
    Posts
    121

    Re: Opening external file and program

    Use ShellExecute:

    Code:
    Option Explicit
    
    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
    
    Private Sub Command1_Click()
    Dim rc As Long
    
        rc = ShellExecute(Me.hWnd, "open", "D:\Documents\Owners\PATIENT.PDF", "", "", 1)
        
    End Sub

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