Scheduled task method of opening Excel questions.

R

Richard Burton

Hello All,

I have a workbook that needs updating overnight. I'm trying to achieve this
by using the Windows Scheduled Tasks function.

Currently I'm just trying to get Excel open. However, I'm getting a couple
of prompts when Excel opens to which I need to click Ok. One is a general
system security message, and the other is to confirm my login details to Sun
Vision. Can this be done?

Also, How do I get a specific excel file opened by the Scheduled Task?

Thanks

Richard
 
K

ker_01

I have a .vbs file that opens Excel and processes a target workbook (runs a
macro). I set the scheduled task to run the .vbs file. Code is provided below
for you to adapt as desired.

I can't help you on the prompts- if they are Excel specific prompts you may
be able to use .displaynotifications; if you are actually required to sign in
to another system you may be able to use sendkeys.

Sample code for an uncomplicated, scheduled Excel macro:

strUserIn = MsgBox("Do you want to run the XYZ file ?",vbYesNo,"Automated
Prompt")
If strUserIn = 6 then
Set objExcel = CreateObject("Excel.Application")
Set objWorkbook = objExcel.Workbooks.Open("C:\path\filename.xls")
objExcel.Visible = True
objExcel.Run "CrunchIt" 'the name of my macro
objExcel.ActiveWorkbook.Save
objExcel.ActiveWorkbook.Close(0)
objExcel.Quit
end if
 

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