invoke a VBscript from within a word macro

T

tygerc

hi, all

I'm trying to invoke a vbscipt from within a word macro.

I'm using

RetVal = Shell("C:\docs\binfile.vbs", 0)

however, this gives me an error:

" Run-time error '5':
Invalid procedure call or argument"

Does anyone know how to do this.. if I replace the path of vbscript
with an EXE file, it works fine.. and if I call the vbscript frm the
command line. it also works fine. thanks..
 
K

Karl E. Peterson

hi, all

I'm trying to invoke a vbscipt from within a word macro.

I'm using

RetVal = Shell("C:\docs\binfile.vbs", 0)

however, this gives me an error:

" Run-time error '5':
Invalid procedure call or argument"

Does anyone know how to do this.. if I replace the path of vbscript
with an EXE file, it works fine.. and if I call the vbscript frm the
command line. it also works fine. thanks..

Generally, VBS files need to be fed to cscript.exe or wscript.exe to run...

RetVal = Shell("cscript C:\docs\binfile.vbs", 0)
 
T

tygerc

Thanks Karl. just the stuff I need, the only thing I had to
do is provide the full path to cscript.

thanks so much...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top