Need correct syntax for opening VBS script from within Microsoft Access.

Opening a vbs script from within Microsoft Access VBA - I get the error run-time error - Invalid procedure or call or argument.
with the yellow highlight on:  Shell "" & sOpenFileLocal & "", vbNormalFocus

Shell "" & sOpenFileLocal & "", vbNormalFocus
      Exit Function

Open in new window

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Gustav BrockCIOCommented:
You need to call a command with Shell like:

cscript yourscript.vbs

Open in new window

Bill PrewIT / Software Engineering ConsultantCommented:
And if you want it to run in Window mode rather than command line then do:

wscript yourscript.vbs

And if your file path for the VBS file could contain spaces then do:

sVbsPath = "C:\temp\my file.vbs"
sOpenFileLocal = "cscript """ & sVbsPath & """"
Shell sOpenFileLocal, vbNormalFocus

Open in new window


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
stephenlecomptejrAuthor Commented:
Bill how can I open it without the windows command prompt coming up?
Get Blueprints for Increased Customer Retention

The IT Service Excellence Tool Kit has best practices to keep your clients happy and business booming. Inside, you’ll find everything you need to increase client satisfaction and retention, become more competitive, and increase your overall success.

stephenlecomptejrAuthor Commented:
I don't want it to run in Windows mode I guess.
stephenlecomptejrAuthor Commented:
never mind I see to change Cscript to Wscript...
stephenlecomptejrAuthor Commented:
Thank you both for your comments.
Bill PrewIT / Software Engineering ConsultantCommented:

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
VB Script

From novice to tech pro — start learning today.