Greetings, is there a way to have a Script run at a specified time? I have an
Excel workbook that backs up a huge amount of info programmatically that
works great. I have recently begun experimenting with VBScript; I have
written this script and would like to have it run daily without having any
user interaction. I could also use a tip on how to have Scripts run in the
command Prompt automatically.

Option Explicit

Dim objExcel

Set objExcel = CreateObject("Excel.Application")

wscript.echo "Please Wait"
wscript.echo "Backing Up ..."

objExcel .Visible = False
objExcel .Workbooks.Open "C:\FolderPath\WorkbookName.xls"

Wscript.Echo "Finished"

Re: Start - End Time Question by McKirahan

McKirahan
Tue Jul 08 10:05:42 CDT 2008

"Office_Novice" <OfficeNovice@discussions.microsoft.com> wrote in message
news:E7B0B255-71E7-4610-9AC1-E5CBBA930ECD@microsoft.com...
> Greetings, is there a way to have a Script run at a specified time? I have
an
> Excel workbook that backs up a huge amount of info programmatically that
> works great. I have recently begun experimenting with VBScript; I have
> written this script and would like to have it run daily without having any
> user interaction. I could also use a tip on how to have Scripts run in the
> command Prompt automatically.
>
> Option Explicit
>
> Dim objExcel
>
> Set objExcel = CreateObject("Excel.Application")
>
> wscript.echo "Please Wait"
> wscript.echo "Backing Up ..."
>
> objExcel .Visible = False
> objExcel .Workbooks.Open "C:\FolderPath\WorkbookName.xls"
>
> Wscript.Echo "Finished"

Your Subject has nothing to do with your question.

Google "windows schedule scripts".

Don't use the initial two "WScript.Echo" statements
for a scheduled script as they require user interaction
(unless run at the command prompt).

Use "cscript" to run a script from the command prompt:
cscript.exe //nologo your_script.vbs



Re: Start - End Time Question by Pegasus

Pegasus
Tue Jul 08 10:09:26 CDT 2008


"Office_Novice" <OfficeNovice@discussions.microsoft.com> wrote in message
news:E7B0B255-71E7-4610-9AC1-E5CBBA930ECD@microsoft.com...
> Greetings, is there a way to have a Script run at a specified time? I have
> an
> Excel workbook that backs up a huge amount of info programmatically that
> works great. I have recently begun experimenting with VBScript; I have
> written this script and would like to have it run daily without having any
> user interaction. I could also use a tip on how to have Scripts run in the
> command Prompt automatically.
>
> Option Explicit
>
> Dim objExcel
>
> Set objExcel = CreateObject("Excel.Application")
>
> wscript.echo "Please Wait"
> wscript.echo "Backing Up ..."
>
> objExcel .Visible = False
> objExcel .Workbooks.Open "C:\FolderPath\WorkbookName.xls"
>
> Wscript.Echo "Finished"

Launch your script via the Windows Task Scheduler!



Re: Start - End Time Question by Alex

Alex
Tue Jul 08 12:18:30 CDT 2008

As Pegasus mentioned, use the Task Scheduler; and as McKirahan said, you
want to make sure you don't use WScript.Echo (or MsgBox, etc.) since they
can cause a script to fail when run non-interactively. A couple of other
points to mention:

+ You'll want to run the script with cscript as mcKirahan mentioned; you
also should probably include the //B switch in the command line to ensure
batch mode ( if you run cscript //? or wscript //? you'll get a listing of
all commandline options for WSH scripts in general).

+ I can restrict how long the script runs by used the //T switch. If the
script should exit after 60 seconds, use //T:60, for example.

+ Be careful about what you do with Microsoft Office applications if you're
running from a server. Office apps are notoriously poor at unattended tasks,
since they've never really been designed as true client-server applications.
This means that the results of running an Office script are unpredictable
when it isn't running in an interactive GUI session.

"Office_Novice" <OfficeNovice@discussions.microsoft.com> wrote in message
news:E7B0B255-71E7-4610-9AC1-E5CBBA930ECD@microsoft.com...
> Greetings, is there a way to have a Script run at a specified time? I have
> an
> Excel workbook that backs up a huge amount of info programmatically that
> works great. I have recently begun experimenting with VBScript; I have
> written this script and would like to have it run daily without having any
> user interaction. I could also use a tip on how to have Scripts run in the
> command Prompt automatically.
>
> Option Explicit
>
> Dim objExcel
>
> Set objExcel = CreateObject("Excel.Application")
>
> wscript.echo "Please Wait"
> wscript.echo "Backing Up ..."
>
> objExcel .Visible = False
> objExcel .Workbooks.Open "C:\FolderPath\WorkbookName.xls"
>
> Wscript.Echo "Finished"
>
>
>