Cannot Open External App using Shell in Access 2013

papic1972

Registered User.
Local time
Tomorrow, 00:31
Joined
Apr 14, 2004
Messages
122
Hi all,

In previous versions of Access (i.e 2003 and prior) I could use the following code in the On Click event of a form's command button to open an external file:

Dim stAppName As String

stAppName = "C:\Program Files\Cadro\TransPost Plus\TransPostPlus.exe"
Call Shell(stAppName, 1)


However, I'm now using Access 2013 and it wont allow me to use this anymore, it gives me the following error:

Runtime Error '5"'
Invalid procedure call or argument

Does anyone know why this doesn't work in Access 2013?

Thanks.
 
I can't get it to work for me like that, I don't know why. Thanks anyway for your response.

I've got to work this way:

Create a Module:

Option Compare Database

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 lpnShowCmd As Long) As Long


Public Sub ShellEx(ByVal Path As String, Optional ByVal Parameters As String, Optional ByVal HideWindow As Boolean)

If Dir(Path) > "" Then
ShellExecute 0, "open", Path, Parameters, "", IIf(HideWindow, 0, 1)
End If

End Sub

And in the 'On Click' event:

ShellEx "C:\Program Files\Cadro\TransPost Plus\TransPostPlus.exe"
 

Users who are viewing this thread

Back
Top Bottom