CodeItBetter Programming Another VB Programming Blog

How to open any file with its default application

Posted on January 5, 2009
1
2
3
4
5
6
7
8
9
10
11
12
13
'System & API - How to open any file with its default application
Option Explicit
 
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
 
Public Sub OpenFile(ByVal sFileName As String)
    Call ShellExecute(0, "Open", sFileName, vbNullString, vbNullString, vbNormalFocus)
End Sub
 
'How can I call this function:
'Call OpenFile("www.gmail.com")
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


 

No trackbacks yet.