By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,985 Members | 2,877 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,985 IT Pros & Developers. It's quick & easy.

Shell Command

P: n/a
I am trying to shell out to run a VB script file. I do not need to track the
progress of the shell. It can fire off and then the VBA code can continue.

The code I have is:

hTask = Shell("c:\Cdosmtp.vbs", 1)

I have tried to dim hTask as an integer and Long, as well as no designation
but I am receiving a Run-time Error 5 on that line.

Is this not the correct way to shell from an Access VBA module?

I have never used the shell command in Access VBA before, how does it work?

m charney at dunlap hospital dot org
Apr 19 '06 #1
Share this Question
Share on Google+
1 Reply

P: n/a
1.One can execute c:\Cdosmtp.vbs efficiently with
Shell "c:\Cdosmtp.vbs", vbNormalFocus
unless one were needs the program's Task ID in order to close it later
through code; code is more easily understood when we use named
constants rather than literal numbers;

2. As VBS and VBA are very similar, and in most cases identical, it's
quite likely that you can just import and run the VBS script; this is
likely to far more malleable than shelling;

3. It's quite possible that the Run Time Error 5 (Invalid procedure
call or argument) is in the VBS script, and not in the Shell call as
that seems to be correct. It's a great idea to include the error
description when asking for help.

Apr 19 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.