Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Opening Files From VB

Status
Not open for further replies.

RohanP

Programmer
Mar 6, 2002
50
IN
Hi There,

I have created an application which show list of files in a listbox

eg:-

ListBox Values
D:\File1.doc
D:\File1.xls
D:\File1.mdb
D:\File1.pdf


I want my app to open selected file on click of a button.

if user select value 1 then file1.doc should open with its associated program i.e. MS-Word. In case of file1.xls file should open with Excel.

How can do that

Help will be appriaciated

______________________________
- Regards Rohan (India,Mumbai)
 
Since search is down right now...

Code:
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 Form_Load()
    ShellExecute 0, "open", "Word Doc Path Here", "", "", 1
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top