ShellExecute

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Does anyone know where I can find a detailed error code list for the
shellexecute function? Most of the sites I've found either use constants with
no conversion to the number, or only go up to around 22. I keep getting error
code 41 when I try to open a text file, any ideas?

Thank-you in advance.
 
Thanks for the response. I'm using it as follows:
Public 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

and:

Public Function ShellExec(ByVal strFile As String)
Dim lngErr As Long
lngErr = ShellExecute(0, "OPEN", strFile, "", "", 0)
End Function

I have stepped through the procedure that calls it, and it passes the string
to the ShellExec function, and this string matches the file path exactly.
However, to make sure, I deleted the file it was trying to open, and I got a
different error message (so I presumed it was at least locating the file). I
then replaced the fileName.txt with a fileName.doc, and this opened fine,
which leads me to believe it has something to do with plain text files. Any
ideas?

Thank-you.
 
That code use a vbNullString where I used an "OPEN", and hWndAccessApp where
I used a 0. I replaced those two and everything works fine.

Thanks for the help.
 
Checking the length of a variable with vbNullString is usefull because it
checks both Null and empty string. I always use:

If Len(myVar & vbNullString) > 0 Then

because it never fails.
 
Back
Top