Auto execute the Button every 20 Minutes

  • Thread starter Thread starter ali
  • Start date Start date
A

ali

I have button on a form which performs a functions (Importing data)

I'd like the button to run automatically every 30 minutes.


Pls tell me the "Code" and steps to do it .





THank you so much, dear expert !
 
Set the form's TimerInterval to the appropriate value (1200000 for 20
minutes, 1800000 for 30 minutes), then use the form's Timer event to call
the appropriate code.
 
Private Sub Form_Timer()

Call MyCommandButton_Click

End Sub

(where you need to replace MyCommandButton_Click with the name of the actual
routine that runs the code you want run)

If you want the code to run every twenty minutes starting when the form
first opens, you can set the form's TimerInterval property when you open the
form:

Private Sub Form_Load()

Me.TimerInterval = 1200000

End Sub

If you want the code to run every twenty minutes starting when you first
click on the button, set the TimerInterval property in the Click event of
the button.
 
Back
Top