I'd like to use the Application.ontime method to call a button_click event on my Excel form.
when i use this code I can call a sub located in my Module1:
Application.OnTime Now + TimeValue("00:00:15"), "test"
However if I use this code it doesn't call my Private Sub CommandButton1_Click (it does nothing):
Application.OnTime Now + TimeValue("00:00:15"), "CommandButton1_Click"
How can I call a click on my button "CommandButton1"
Thanks for your help!
You need to expose the desired functionality. In a standard module enter, for example:
Public Sub ReallyVisibleMacro()
MsgBox "Hello World"
End Sub
This sub does all the real work. Then your button code would be:
Private Sub CommandButton1_Click()
Call ReallyVisibleMacro
End Sub
and in the OnTime code:
Application.OnTime Now + TimeValue("00:00:15"), "ReallyVisibleMacro"