Hi, sorry if this has already been dealt with, but I could not find anything about it with a search.
I am trying to use the application.ontime procedure to run a class method, but having a little trouble with what to use as my procedure name. Do I have to include the name of the class, or the name of the instantiation of the class, or what? Here is kind of what I have in the "myClass" class module:
Option Explicit Private WithEvents m_cmdButton As MSForms.CommandButton Private m_iTimer As Double Private Sub m_cmdButton_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single) ' Set the time with the long delay m_iTimer = Now + TimeSerial(0, 0, I_TIMER_DELAY_LONG) ' Start the timer Call Application.OnTime(earliesttime:=m_iTimer, procedure:="ClickAgain", schedule:=True) End Sub Private Sub ClickAgain() Call MsgBox("ClickAgain successfully called.", , "Boo yeah!") End Sub
I have checked and the MouseDown event is being registered: it will work if I use a procedure in a standard module rather than the class method"ClickAgain". (I am only including the code relevant to the "ontime" procedure. My actual class has other methods to deal with setting the control source for the command button & everything.) So I am kind of stumped, any help you guys could offer on this point would be very helpful, thanks.