Reputation: 15
I am working in VBA in word and I want to call my macro after every 2 secs Is there any way around?
Upvotes: 0
Views: 1213
Reputation: 49453
When a document opens, or any other event of your choice, execute the following code which starts the routine using the Application.OnTime method:
alertTime = Now + TimeValue("00:02:00")
Application.OnTime alertTime, "EventMacro"
Then just have a VBA macro sub called EventMacro
that will repeat it.
Public Sub EventMacro()
'... Execute your actions here'
alertTime = Now + TimeValue("00:02:00")
Application.OnTime alertTime, "EventMacro"
End Sub
Upvotes: 0