Home Excel Powerpoint Word Outlook Error Codes

VBA Useful Codes

Welcome to the World of VBA
Home > VBAUsefulCodes

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.

Public Sub setTimer()
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) 

End Sub

Function displaymsg()
MsgBox "Hello, This is a test reminder msg"
End Function


Enter your e-mail below and get notified on the latest blog posts.


VBA Outlook KPI Excel Alt+F11 Dashboards Macros Recording Graphs Automation Developer WaterFall Powerpoint Charts Pivot Tables Forecast Charts

Follow Us