Once you've collected the string for the application you want to open, you can use the StartDoc Function (below) which uses the Shell Execute Method.
Once you have collected a string for the application you want to open, you simply use the following:
Call StartDoc(Path String)
Call StartDoc("C:\My Documents\Spreadsheets\Test.xls"

OR
Call StartDoc("C:\My Documents\Text Files\Test.txt"

OR
for a network drive (unc path)
Call StartDoc("\\stcnov01\Data\users\jim\My Documents\spreadsheets\phonelist.xls"
Copy the following into a blank module and save it: Then you can use the StartDoc function to open other applications.
====================
Public 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
Public Declare Function GetDesktopWindow Lib "user32" () As Long
Public Const SW_SHOWNORMAL = 1
Public Const SE_ERR_FNF = 2&
Public Const SE_ERR_PNF = 3&
Public Const SE_ERR_ACCESSDENIED = 5&
Public Const SE_ERR_OOM = 8&
Public Const SE_ERR_DLLNOTFOUND = 32&
Public Const SE_ERR_SHARE = 26&
Public Const SE_ERR_ASSOCINCOMPLETE = 27&
Public Const SE_ERR_DDETIMEOUT = 28&
Public Const SE_ERR_DDEFAIL = 29&
Public Const SE_ERR_DDEBUSY = 30&
Public Const SE_ERR_NOASSOC = 31&
Public Const ERROR_BAD_FORMAT = 11&
Public Function StartDoc(DocName As String) As Long
' Example: Call StartDoc("C:\error.log"

Dim Scr_hDC As Long
Dim msg As String
Scr_hDC = GetDesktopWindow()
StartDoc = ShellExecute(Scr_hDC, "Open", DocName, "", "C:\", SW_SHOWNORMAL)
If StartDoc <= 32 Then
'There was an error
Select Case StartDoc
Case SE_ERR_FNF
msg = "File not found"
Case SE_ERR_PNF
msg = "Path not found"
Case SE_ERR_ACCESSDENIED
msg = "Access denied"
Case SE_ERR_OOM
msg = "Out of memory"
Case SE_ERR_DLLNOTFOUND
msg = "DLL not found"
Case SE_ERR_SHARE
msg = "A sharing violation occurred"
Case SE_ERR_ASSOCINCOMPLETE
msg = "Incomplete or invalid file association"
Case SE_ERR_DDETIMEOUT
msg = "DDE Time out"
Case SE_ERR_DDEFAIL
msg = "DDE transaction failed"
Case SE_ERR_DDEBUSY
msg = "DDE busy"
Case SE_ERR_NOASSOC
msg = "No association for file extension"
Case ERROR_BAD_FORMAT
msg = "Invalid EXE file or error in EXE image"
Case Else
msg = "Unknown error"
End Select
If msg <> "Unknown error" Then MsgBox msg
End If
End Function
==================== Jim Lunde
compugeeks@hotmail.com
Custom Application Development