|
Subject:
|
Shell command execution error
|
|
Posted By:
|
toshesh
|
Post Date:
|
12/30/2005 6:57:58 AM
|
Hi,
I'm getting an error when I try to run a shell command to open a file. The error is "Run-time error '5': Invalid procedure call or argument"
I am using ACCESS 2003 with VB 6.3 (Perhaps I am using VBA) Here is the code below. Please someone help!!!
Private Sub OpenProposal_Click()
Dim RetVal As Double
RetVal = Shell("C:\db1\Proposals\tes.xls", vbNormalFocus)
End Sub
|
|
Reply By:
|
herry_basoya
|
Reply Date:
|
1/6/2006 1:46:44 AM
|
Use Microsoft Shell Control And Automation Reffernce in your Project Then Dim ts As New Shell32.Shell to open a file ts.Open ("c:\files\abc.xls") Hope it will solve your problem
|
|
Reply By:
|
toshesh
|
Reply Date:
|
1/6/2006 8:13:42 AM
|
Thank you for you reply!
I managed to do it another way..., got the code from some website Is this the same thing?
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
res = ShellExecute(hwnd, vbNullString, fname, vbNullString, vbNullString, vbNormalFocus)
|
|
Reply By:
|
herry_basoya
|
Reply Date:
|
1/7/2006 2:17:39 AM
|
You are using API in the code you provide but it is OK to use API.
|