Code:
Option Explicit
'Use Shelldef to open a file with the associated app
'
Private Declare Function ShellEx Lib "shell32.dll" Alias _
"ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, _
ByVal lpFile As String, ByVal lpParameters As Any, _
ByVal lpDirectory As Any, ByVal nShowCmd As Long) As Long
'
Sub ShellDef(strFileName)
Dim x
x = ShellEx(Form1.hwnd, "open", strFileName, "", "", 1)
End Sub
Private Sub Form_Load()
'
Dim strYourFileVariable$
strYourFileVariable = "excel.exe"
ShellDef strYourFileVariable
End Sub