![]() |
time specific macros
i was told about time specific macros if i want a report to run during the
night from my acd into excel then excel to grab the data and then into the report for my managers is this the case because i cant find anything on the this |
time specific macros
Hi James,
As a start, see VBA help for the OnTime method. --- Regards, Norman "dobson,james" wrote in message ... i was told about time specific macros if i want a report to run during the night from my acd into excel then excel to grab the data and then into the report for my managers is this the case because i cant find anything on the this |
time specific macros
hi,
here is code i use to set a macro to run a 5am weekdays only. the PC has to be on for it to fire. i start the macro when i leave work each day at 5 pm. there are 2 subs here. 1 is prelaunch and decide if it friday or not and displays the appropriate message. the second sub takes over and sit on the appropriate action until time to fire. it calls a third sub call macAStart which is the main macro. regards. FSt1 Sub macAAPrelaunchMR() Set LookDate = Range("A1") If LookDate = Date Then MsgBox ("The Morning Routine has been run today. Update not allowed at this time.") Exit Sub Else Range("B1").Select Range(ActiveCell, ActiveCell.Offset(40, 5)).ClearContents Range(ActiveCell, ActiveCell.Offset(40, 5)).Interior.ColorIndex = Automatic Selection.Font.ColorIndex = 0 Range("B3").Select If Weekday(Now()) = 6 Then ActiveCell.FormulaR1C1 = " This Macro will not start until Monday Morning about 5:00am " & Date + 2.5 Else ActiveCell.FormulaR1C1 = "This macro will not start until 5:00am " & Date + 1 ActiveCell.Offset(1, 0).Select End If End If Range("B5").Select Call macALaunchMR End Sub Sub macALaunchMR() If Weekday(Now()) = 6 Then '1 = Sunday, 2 = Monday, 3 = Tuesday, ect Application.OnTime Now() + 2.5 + TimeValue("00:00:03"), "macAStart" Else Application.OnTime TimeValue("05:00:00"), "macAStart" End If End Sub "dobson,james" wrote: i was told about time specific macros if i want a report to run during the night from my acd into excel then excel to grab the data and then into the report for my managers is this the case because i cant find anything on the this |
All times are GMT +1. The time now is 08:45 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com