Run-time error '5':
Invalud procedure call or argument
and it shows up for this line:
i am completely stumptedCode:x = Shell ("c:\Progra~1\VIH\VIHdata.mdb /x mcrVBSys_ExpMdl", vbNormalFocus)
thanks
Dimava
Printable View
Run-time error '5':
Invalud procedure call or argument
and it shows up for this line:
i am completely stumptedCode:x = Shell ("c:\Progra~1\VIH\VIHdata.mdb /x mcrVBSys_ExpMdl", vbNormalFocus)
thanks
Dimava
As the Shell function is only used to run executable programs, you'll have to use the ShellExecute API call.
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 Command1_Click()
Dim RetVal As Long
RetVal = ShellExecute(Me.hwnd, "open", "c:\Progra~1\VIH\VIHdata.mdb", "/x mcrVBSys_ExpMdl", "", vbNormalFocus)
End Sub
thanks for the reply, but why is /x mcrVBSys_ExpMdl seperated from the math to the db?
right now it opens the DB, but it doesnt run the macro
thanks,
Dimava
I split that out because of the lpParameters variable. I may be incorrect in thinking that it had to be split out (notice directory does not), so you may be able to put everything in that one string. I am not certain.
Good ol' Run-time error '5' :)