Hi, guys. I'm back and I have a problem.
How can I open any file? For example, the user types in a path and vb opens the file( a doc, bmp,psd or any registered extension). Can you help me out?
Printable View
Hi, guys. I'm back and I have a problem.
How can I open any file? For example, the user types in a path and vb opens the file( a doc, bmp,psd or any registered extension). Can you help me out?
use ShellExecute if you want to launch default app.
sample
VB Code:
Option Explicit Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" _ (ByVal hwnd As Long, ByVal lpszOp As String, _ ByVal lpszFile As String, ByVal lpszParams As String, _ ByVal LpszDir As String, ByVal FsShowCmd As Long) _ As Long Private Sub Command1_Click() 'Open a web page Dim l As Long l = ShellExecute(Me.hwnd, "Open", "http://www.vbworld.com", "", "C:\", vbNormal) End Sub Private Sub Command2_Click() 'Open a document Dim l As Long l = ShellExecute(Me.hwnd, "Open", App.Path & "\Test.Doc", "", "C:\", vbNormal) End Sub
Thanx, man! It worked!
you r welcome PNF :)
it usually does ;)