Running vba Application.OnTime TimeValue events in closed workbooks

Spoursy

New Member
Joined
Dec 4, 2019
Messages
30
Office Version
  1. 365
Platform
  1. Windows
Is it possible to run vba Application.OnTime TimeValue events in closed workbooks?

I run the folling macros in a 365 coauthored work book

Private Sub Workbook_Open()
Application.OnTime TimeValue("09:00:00"), "TasksAt9"
Application.OnTime TimeValue("12:30:00"), "TasksAt1230"
Application.OnTime TimeValue("16:00:00"), "TasksAt4"
Application.OnTime TimeValue("16:01:00"), "CopyPasteDataFromDailyPerformanceToConsolidationSheet"
Application.OnTime TimeValue("16:02:00"), "ClearContentsDailyPerformance"

Thanks in Advance
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
No, it is not possible to run VBA Application.OnTime events in closed workbooks. This is because Application.OnTime relies on the Excel application instance to execute the VBA code at the specified time. When a workbook is closed, the Excel application instance is no longer running, so any scheduled Application.OnTime events in that workbook will not run.

If you need to run VBA code at specific times even when the workbook is closed, you can consider using an external scheduling tool or a Windows task scheduler to run a separate VBA script or batch file that opens the workbook and executes the necessary VBA code.

Alternatively, you can consider using a different approach to automate your tasks, such as using Power Automate or a third-party add-in that can run scheduled tasks in the background without relying on Application.OnTime.
 
Upvote 0

Forum statistics

Threads
1,215,064
Messages
6,122,941
Members
449,094
Latest member
teemeren

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top