Pass a parameter to .OnAction macro


Posted by Bill on July 25, 2001 10:32 AM

I am trying to use Application.Ontime to run a macro at a specified time. It works using this format:

Application.OnTime _
EarliestTime:=NextTime, _
Procedure:="MyMacro"

What happens when ProcString is a macro that can accept two arguments? Is there any way that I can pass those arguments?
Procedure:="MyMacro arg1:=1, arg2:=5"
does not work.



Posted by Jerid on July 25, 2001 12:27 PM


How about doing it this way

Application.OnTime _
EarliestTime:=NextTime, _
Procedure:="CallMyMacro"


Sub CallMyMacro
Call MyMacro(arg1:=1, arg2:=5)
End Sub

Sub MyMacro(arg1 as Integer, arg2as Integer)
'Your code
End Sub

Jerid