• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Is it possible to automatically open spreadsheets & run macros at a certain time of the day

Hi,

Understand this may not be the best forum to ask this. But just wondering if it is possible to do this. Say early in the morning every weekday (say 5 or 6am each day) - could my computer automatically open a spreadsheet and run a macro to save me from having to manually doing it when I get in at 9am ? The macro takes about an hour to run & it is time that could be better spent if it is already ran when I get in.
 
Hi,

Try this:
Step1: open your workbook by windows task scheduler
Step2: write a function in your macro which is able to launch your code when the workbook can be considered as opened
 
You can use Task Scheduler in Windows to run programs at scheduled times. If you have code in the workbook to automatically run the macro when it opens, then you just need a task to run Excel and open the workbook. Alternatively you could use a small VBScript file to load Excel, open your workbook and run the macro. Then all you need to do is run the script via the scheduled task.
 
Ah yes thanks - I don't want the Macro to run everytime I open the file, but if I create a VBscript that sounds like it'll work - time to youtube how to use task scheduler then :DD

Thanks for your help
 
Hello,
Step1: open your workbook by windows task scheduler
Step2: Put this piece of code under this workbook in the vba editor
Code:
Private Sub Workbook_Open()
If Weekday(Now, vbMonday) < 6 Then
Application.OnTime TimeValue("08:00:00"), "Your macro"
End If
End Sub
This code will start every day at 08:00 am from monday to friday
If you change <6 to <7 it will run from moday to saturday
Change ("08:00:00") to the time you need
Change Your macro to the name of the macro that has to run
greetz
 
Back
Top