Running vba Application.OnTime TimeValue events in closed workbooks

Spoursy

New Member
Joined
Dec 4, 2019
Messages
32
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

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
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,223,246
Messages
6,170,999
Members
452,373
Latest member
TimReeks

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