REPEAT SOME ACTION IN MACRO

  • Thread starter Thread starter SURESH
  • Start date Start date
S

SURESH

Hi dear friends,

its an simple question for you....
i want to repeat some action in my excel workbook at every 5 minuts.. by the
help of VB

just like

Private Sub Workbook_Open()
Application.ScreenUpdating = false
dim ST, NT as date
ST = timer
nt = st + TimeValue("00:05:00")
loop
if nt = timer then
call XXX
end if
do events
end loop
End Sub

can anyone help me??

thanks in advance

suresh tp
 
Code:
--------------------

Private Sub Workbook_Open()
Application.OnTime Now + TimeValue("00:00:05"), "OnTimer"
End Sub

Sub OnTimer
dim ST as Date, NT as date
Application.ScreenUpdating = false
'*
'* Your code here
'*
DoEvents
'*
'* Reschedule the interrupt
'*
Application.OnTime Now + TimeValue("00:00:05"), "OnTimer"
Application.ScreenUpdating = True
End Sub

--------------------


Regards

Rich
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top