Wscript.Shell Run vbs Fails?

R

RayportingMonkey

OK - What am I doing wrong?

'Move Files To Their Archive Locations
Dim movScrpt As Object
Set movScrpt = CreateObject("Wscript.Shell")
movScrpt.Run "\\ServerName\Enterprise Forecasting & Scheduling
Team\MoveReports.vbs"


I get a Run-Time error '-2147024894(80070002)':
Method 'Run' of object 'IWshShell3' failed
 
S

Steve Yandl

You might want to check VBA's help regarding the 'Shell' function. That
would probably be a better option that having to create an instance of
"Wscript.Shell". In fact, if your vbs file is simply using the
"Scripting.FileSystemObject" to move files, you might consider doing the
same thing from within VBA and avoid messing with the vbs file.

To answer your question though, whether you use WScript.Shell or the Shell
function, the executable you want to run is either wscript.exe or
cscript.exe with the vbs file passed to the executable as an argument.

Steve
 

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