Runs a certain macro on certain time.
This is not a scheduler, but just simple code to run a macro at certain time. Excel workbook has to stay open to let that run work.
It was originally from another site, simplify it and add some flexibility to it.
Sub RunOnTime(CallSub, Optional TimeString = "15:30:00")
' Calling A Function At Specific Time Using Excel VBA Application.Ontime
' Using Application.OnTime we can schedule a procedure or function to be run at a specified time or in the future time.
' Assuming workbook is left open
' Ready to use VBA Useful Codes! Try Now! http://play.google.com/store/apps/details?id=com.vbausefulcodes.dp https://www.vbausefulcodes.com
Application.OnTime TimeValue(TimeString), CallSub
' Application.OnTime TimeValue("15:13:50"), "displaymsg"
' Set Time when the displaymsg function should be called
' In this sample we set time at 3:13:50 PM (HH:MM:SS)
'Function displaymsg()
' MsgBox "Hello, This is a test reminder msg"
'End Function
End Sub
' Calling A Function At Specific Time Using Excel VBA Application.Ontime
' Using Application.OnTime we can schedule a procedure or function to be run at a specified time or in the future time.
' Assuming workbook is left open
' Ready to use VBA Useful Codes! Try Now! http://play.google.com/store/apps/details?id=com.vbausefulcodes.dp https://www.vbausefulcodes.com
Application.OnTime TimeValue(TimeString), CallSub
' Application.OnTime TimeValue("15:13:50"), "displaymsg"
' Set Time when the displaymsg function should be called
' In this sample we set time at 3:13:50 PM (HH:MM:SS)
'Function displaymsg()
' MsgBox "Hello, This is a test reminder msg"
'End Function
End Sub
CallSub, Optional TimeString = "15:30:00"
Views 80
Downloads 29
CodeID
DB ID