An executable file to run a VB script?

Z

Zakynthos

Is it possible to construct an executable file that will run from Windows XP
that will launch a VB script in Excel?

I would like to be able to assign this .exe program to Windows Task
Scheduler in order to send data to other programs at regular intervals.
 
B

Bob Phillips

Why not just create a VBScript (.vbs, not VBA in Excel) that creates an
Excel instance and does some stuff, or a workbook with a workbook open event
that does the stuff and is started regularly via scheduler.

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)
 
Z

Zakynthos

Bob,

Thanks for that - but could you give me an example of the script that would
do this as I have no idea how to start a .vbs script that creates an Excel
instance?
 
Z

Zakynthos

Bob,

I've found an example of an vbs script that would run a macro and have
adapted it to my workbook/macro on:

http://krgreenlee.blogspot.com/2006/04/excel-running-excel-on-windows-task.html

But I'm not clear how to use a cscript.exe program rather than a wscript.exe
as referred to below in this blog - what's the diference and how do I write
these scripts to run my VBS Excel controller?:

"3) Launch the VBS Excel Controller using cscript.exe NOT wscript.exe. So
let’s say you named the script RunExcel.vbs, then you would execute it using
‘cscript.exe RunExcel.vbs’. (If you make 'YourWorkbook' and 'YourMacro' input
parameters then the RunExcel.vbs script can run any macro in any workbook
because you can just pass that information in on the command-line.)"
 
S

Steve Yandl

Both wscript.exe and cscript.exe are typically located in the
C:\Windows\System32 folder. CScript.exe is used to run vbs files in console
mode and wscript.exe will run vbs files with the windows user interface that
Windows users are more familiar with. Many vbs files will behave exactly
the same whether you choose wscript.exe or cscript.exe. The differences are
largely in the way output is presented to users and how user input is
obtained. Most system administrators who are wanting a script to be
launched by scheduler will opt for cscript because they're not expecting the
computer user to be involved in the actual functioning of the script when it
runs.


Steve
 
Z

Zakynthos

Steve,

Thanks - I've tried running the script but get various error messages that
the (Excel) file is 'Read only' and is being modified by 'another user' - in
fact it is on my desktop and closed. When I try to open it, it does indeed
open as 'Read only' and I need to log off from the network in order to access
it again. My vbs tries to run but doesn't - could it be network (Novell)
security poreventing me from running it on my company network?

It's very frustrating as I'm 'almost there' - can you suggest a way forward?

many thanks

Tony
 
S

Steve Yandl

If you have been experimenting with the script, press Ctrl-Alt-Del and
review the process list to locate instances of Excel.exe that are running
hidden. If so, they might be causing the message and you can try ending
each Excel process rather than logging off the network and back on. I
suspect that you are dealing with network security issues though. As I
understand your scenario, you're invoking a macro that belongs to an xls
file saved on your PC. Is that macro operating on files elsewhere on your
network?

Steve
 
Z

Zakynthos

Steve,

Many thanks- I'll try the CTRL-ALT-DEL method as you suggest.

However, yes, the macro is operating on programs stored in other locations
on my
network and I think 'll probably have to abandon the idea of using task
scheduler as the IT people won't cooperate with any automation which might
breach security, and there's no other way round I suppose, is there?
 

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