Hi there,
This is the code for opening various files using vb applicaton but here i need to provide the path for file. i want to open any file using vb app using Open Dialog control.
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()
ShellExecute 0&, "OPEN", "D:\test\MCA.pdf", "", "", 1
End Sub
Private Sub Command2_Click()
ShellExecute 0&, "OPEN", "D:\test\MCA.docx", "", "", 1
End Sub
Private Sub Command3_Click()
ShellExecute 0&, "OPEN", "D:\test\MCA.txt", "", "", 1
End Sub
Private Sub Command4_Click()
ShellExecute 0&, "OPEN", "D:\test\MCA.xlsx", "", "", 1
End Sub
Private Sub Command5_Click()
ShellExecute 0&, "OPEN", "D:\test\MCA.jpg", "", "", 1
End Sub
What i did is just i created a folder named "test" in my D drive and put some files(MCA.xlsx,MCA.jpg,MCA.txt,MCA.docx and MCA.pdf). Now i want to open any file by browsing my local drive on click of buttons.