Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using Shell command to open exe file 1

Status
Not open for further replies.

juddymarch

Technical User
Aug 10, 2007
17
Hi, I have an access form that is used to open other access applications using the shell command.
This is working fine but now my client would also like to be able to open one of their third party programs from this form as well.
There is currently a desktop shortcut which is used to open their third party program.
The shortcut contains the following
Target - C:\PBS4\tb40\TB40RUN.EXE C:\PBS4\fld\Hyper4.exe
Startin - C:\PBS4\fld

I thought I could just use the properties from the shortcut to open the program.
I have tried the following code within a shell command:
myShell = Chr(34) & "C:\PBS4\tb40\TB40RUN" & Chr(34) & " " & Chr(34) & "C:\PBS4\fld\Hyper4" & Chr(34)

Shell myShell, vbMaximizedFocus

When I run the code I get an error message "Not a valid file name". However this error message appears to come from the exe application I'm trying to open.

Just wondering if anyone would know what is wrong with my shell command, or if this is possible with the shell command. I have tried swapping things around etc but haven't had any luck.

Thanks
Justin
 
I think this could open their shortcut

Code:
Dim a As Long

a = Shell("RUNDLL32.EXE URL.DLL,FileProtocolHandler " &  strLNK, vbMaximizedFocus)

Where strLNK is full path and name of the shortcut
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top