View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
RayportingMonkey RayportingMonkey is offline
external usenet poster
 
Posts: 87
Default Run VBS from VBA?

I've looked in this forum and others, but unfurtunately can't find an answer
as to why my code is not running, although I suspect it may have to do with
the path...

Here's the code that runs as part of a larger routine:

ChDir _
"\\Server01\Directory1\Directory WithSpaceinName\Directory
withSpaces and Ampersand inName\FinalDirectory"
Dim Retval
Retval = Shell("WScript.exe MoveReports.vbs")

I can run "MoveReports.vbs" with no problem. It simply takes a number of
reports from their default location and moves them to various archive
directories.

Unfortunately, I do not have control over the names of folders on the
network (such as those with multiple spaces and control charecters in their
names...) and fear that may be at least part of my issue.

When I run the code, I get an error that states, "Can not find script file
C:\Documents and Settings\my.name\MyDocuments\MoveReports.vbs" which is NOT
the location of nor is it specified in my code!

What am I doing wrong?!

Thanks,
Ray