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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Shell Function

Status
Not open for further replies.

jmb0730

Programmer
May 23, 2005
3
US
I am trying to start an application by clicking a cmd button. I am using the Shell() function but am receiving an Invalid Call Arguement error. I need to be able to click one of eight different cmd buttons to start one of eight different applications. The applications range from excel spreadsheets to batch files. Thanks for any help!
 
Depending on what the other 6 applications are, you may want to also have a look at the ShellExecute function.

See thread222-919673 for details on how to use this.

The reason I bring this up is because you won't simply be able to open the excel spreadsheet without giving the specific path to excel.exe (which is different for different versions, etc.). So using shell you would have to do something like:

Shell "C:\program files\Microsoft Office\Office 10\Excel.exe MySpreadSheet.xls". Shell execute, you just specifiy the path of the spreadsheet.
 
The other 6 applications vary from batches to executables to spreadsheets. The only one I had trouble with was the spreadsheets but I am going to try she shell execute. Thanks
 
Or you can use the RunDLL32 method:

Shell "RUNDLL32.EXE URL.DLL,FileProtocolHandler " & myfulldocname, vbNormalFocus

You can pass any URL (either filename or website) to that procedure and it will open with the default application

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first
'If we're supposed to work in Hex, why have we only got A fingers?'
Essex Steam UK for steam enthusiasts
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top