How do I open a file using APIs?
Thanks
dries
Printable View
How do I open a file using APIs?
Thanks
dries
Use the ShellExecute API function.
VB 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 OpenFile(sFile As String) ShellExecute Me.hwnd, vbNullString, sFile, vbNullString, vbNullString, 1 End Sub Private Sub Command1_Click() Call OpenFile("C:\MyFile.txt") End Sub