VBA Macro for ontime start and end time

vdphhusdwroh

New Member
Joined
Jul 10, 2019
Messages
3
I have a VBA Macro which runs in loop as below, want to specify the start and end time for it to run. Could any of your please help me.

Sub execute()
'' Should run only if current time start time is between 11:00 to 14:00
Do
MsgBox "test", vbInformation
Loop
End Sub
 

vdphhusdwroh

New Member
Joined
Jul 10, 2019
Messages
3
Here is some code that I've compiled But its not working either.





Sub my_Procedure()
MsgBox "processing", vbInformation
End Sub


Sub Timed()
Application.OnTime TimeValue("00:22:35"), "my_procedure"
End Sub


Sub Frequency()
Application.OnTime Now + TimeValue("00:00:03"), "my_Procedure"
End Sub


Sub Stops()
Application.OnTime EarliestTime:=TimeValue("17:00:00"), _
Procedure:="my_Procedure", Schedule:=False
End Sub


What might be going wrong here?
 

Forum statistics

Threads
1,085,564
Messages
5,384,456
Members
401,902
Latest member
lilytran14

Some videos you may like

This Week's Hot Topics

Top