.Justin,
11-28-2009, 03:12 PM
Hi there, I have a macro that i would like to run automaticley every day 10 seconds? I can;t work out how to do this... Would someone be able to help me please?
Excel Version 2007
Excel Version 2007
|
View Full Version : Auto Update .Justin, 11-28-2009, 03:12 PM Hi there, I have a macro that i would like to run automaticley every day 10 seconds? I can;t work out how to do this... Would someone be able to help me please? Excel Version 2007 HaHoBe 11-29-2009, 01:43 AM Hi, Justin, maybe Application.OnTime can help: 'Code for ThisWorkbook Private Sub Workbook_BeforeClose(Cancel As Boolean) On Error Resume Next Call EndProcessing End Sub Private Sub Workbook_Open() StartProcessing End Sub 'module Public Const ciIntervall As Integer = 10 Public Const dsMacro As String = "YourMacro" Public gdNextTime As Double Public gvar As Variant Sub StartProcessing() gdNextTime = Now + TimeSerial(0, 0, ciIntervall) Application.OnTime _ gdNextTime, _ dsMacro End Sub Sub YourMacro() 'your code Call StartProcessing End Sub Sub EndProcessing() On Error Resume Next Application.OnTime _ earliesttime:=gdNextTime, _ procedure:=dsMacro, _ schedule:=False Application.Calculation = gvar End Sub Ciao, Holger |