Solved

add link

Posted on 2003-11-10
5
218 Views
Last Modified: 2010-05-03
hallo there
i want add link in visual basic such as a pdf file and when click it open the select file with its sutable software
can any one help me
0
Comment
Question by:abedalhade
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 1

Accepted Solution

by:
Shaztronics earned 20 total points
ID: 9713754
just do:
Shell("Path")

OR
in module:

Option Explicit

Public 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


Public Function OpenFile(hWnd As Long, strOperation As String, ByVal File As String)
   
    Dim lRet As Long
   
    'these constants are all the values you
    '     can have for
    'the 'nShowCmd' part of the function
   
    Const SW_SHOWNORMAL = 1
    Const SW_HIDE As Long = 0
    Const SW_MAXIMIZE As Long = 3
    Const SW_MINIMIZE As Long = 6
    Const SW_RESTORE As Long = 9
    Const SW_SHOW As Long = 5
    Const SW_SHOWDEFAULT As Long = 10
    Const SW_SHOWMAXIMIZED As Long = 3
    Const SW_SHOWMINIMIZED As Long = 2
    Const SW_SHOWMINNOACTIVE As Long = 7
    Const SW_SHOWNA As Long = 8
    Const SW_SHOWNOACTIVATE As Long = 4
   
    'the 'lpOperation' can have 3 different
    '     values:
    '"Open"
    '"Print"
    'and "Explore" all in quotes
    'if you use vbNullString, the default is
    '     "Open"
   
    'the 'lpFile' is of course the name of t
    '     he file, either
    'and executable or a file with an associ
    '     ation
   
    'the 'lpParameters' part of the function
    '     can hold any command line
    'switches that the called program may ha
    '     ve. You can't use this when
    'opening regular files. You usually don'
    '     t need this.
   
    'lpDirectory is the default directory of
    '     the application, here I just used
    'the application's directory.
   
    lRet = ShellExecute(hWnd, strOperation, File, vbNullString, App.Path, SW_SHOWNORMAL)
   
End Function
0
 
LVL 3

Expert Comment

by:monvelasquez
ID: 9713798
Use the ShellExecute API

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

Const SW_SHOWNORMAL = 1
Private Sub Command1_Click()
    ShellExecute Me.hwnd, "open", "filename.pdf", vbNullString, "C:\", SW_SHOWNORMAL
End Sub
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question