0

hi frnds

here i found many solutions for vb

thanx for all your help

and now i came with a new problem

i have a file (doc,xls,txt, jpg or whtever it is)

here i have to open that file from vb

i have the filename

i cant imagine i have to create objects for each file type

is thr any specific functions thr for solve this (with Codes Plz)

i dont have any

plz help me

thank u

4
Contributors
4
Replies
11
Views
10 Years
Discussion Span
Last Post by Md Saiful
0

Hi,

Use the below code while changing just the file name:

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, vbNullString, "[B]C:\temp.doc[/B]", vbNullString, "C:\", SW_SHOWNORMAL

End Sub
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.