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

Shell command

Status
Not open for further replies.

mot98

MIS
Jan 25, 2002
647
CA
Hi All,

I am trying to use the VB Shell command to start an AS400 IBM client. I am using the following code:
Code:
Shell "C:\kitchener.ws"

I am getting the following error:
"Runtime Error 5: Invalid Procedure call or argument"

The Shell command works fine for any EXE but not the *.ws files.

Is there another way to launch this program?


mot98
[cheers]
"Is it friday yet?"
 
Try...

Shell "[!]CMD /c[/!] C:\kitchener.ws"

-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
I should mention that this will cause whatever application is associated with the extension to open with that file.

For example, if you have a file with .txt as the extension, then notepad will open with the file loaded. If you have a fiel with .xls, then excel will open with the file loaded.

-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
You could also look at thread222-255803 for a better way to implement shelled apps.

The "WS" extension, is that for Windows Scripting? If so, you may want to call the script runner. There are a couple of parameters you can set on it that would indicate to it that you are running it unattended (batch mode):

cscript.exe //B c:\kitchener.ws

 
mot98,

You may also consider using the ShellExecute API call.

Declare it at the top of a module with;

Public 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

Then call it from a procedure within a Form using;

ShellExecute hwnd, vbNullString, "C:\kitchener.ws", vbNullString, vbNullString, vbNormalFocus

This should fire up the .ws file in the application it is associated with in Windows Explorer.

Other comments are as per those George made at 11:30; end results should be the same as his.

regards Hugh,
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top