Application.ontime ...

plo888

New Member
Joined
May 5, 2009
Messages
24
I've been working on this ontime method macro to schedule several daily, weekly and a monthly macros. I click the "ontime macro" once a week because my pc reboots weekly. Thru out the week my daily macros work fine. It's just the weekly, weekly_m2m and monthly that doesnt run. Can someone please tell me what's wrong with my code. I tested these macros by changing the time when i'm in front of the screen and it successfully kicks off, but as you can see i have these macros scheduled early in the morning. Why doesnt it run??

Thanks in advance.


Code:
Sub ontime()
Application.ontime TimeValue("4:30:00"), "daily1"
Application.ontime TimeValue("5:20:00"), "daily2"
Application.ontime TimeValue("5:25:00"), "daily3"
 
If Weekday(Date) = vbSaturday Then
Application.ontime TimeValue("5:30:00"), "weekly"
End If
 
If Weekday(Date) = vbTuesday Then
Application.ontime TimeValue("5:30:00"), "weekly_m2m"
End If
 
If Date = DateSerial(Year(Date), Month(Date), 1) Then 'first of month
Application.ontime TimeValue("6:00:00"), "monthly"
End If
 
End Sub
 
Last edited by a moderator:

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.

Forum statistics

Threads
1,215,461
Messages
6,124,952
Members
449,198
Latest member
MhammadishaqKhan

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