I have a macro which is set to run at a specific time each morning, during the week this runs fine as I close excel down during the day and open it again at night before I leave work.
At the weekend I set it going but it only works on saturday not on sunday or monday morning. I am pretty sure this is because there is no loop in the code and it simply runs it once. Is there any simple way of creating a loop or scheduling a macro which will do this for me? Here is my code;
Private Sub Workbook_Open()
application.OnTime TimeValue("07:35:01 am"), "conn"
application.OnTime TimeValue("07:35:30 am"), "mailinglist1"
End Sub
I tried this but the loop jus kept repeating and performs the task repetitively.
Private Sub Workbook_Open()
x = 1
Do
application.OnTime Now + TimeValue("00:15:00"), "conn"
application.OnTime TimeValue("07:35:30 am"), "mailinglist1"
Loop While x = 1
End Sub
Any help would be greatly appreciated.
Thanks
Psilocybin
[Edited by Psilocybin on 05-09-2005 at 10:11 AM GMT]
[Edited by Psilocybin on 05-09-2005 at 10:13 AM GMT]
____________________________
To be individual there must only be one!
05-09-2005 at 10:10 AM
|
~Bean~ Level: VB Guru Registered: 07-04-2003 Posts: 488
Re: Daily scheduling of a macro
I wonder if there's a better way than Excel to do what you're doind...what are you doing in Excel?
Also, I wonder if you could use Scheduled Tasks to do this more easily...
I don't know any command line arguments for Excel but this worked for me...setup a scheduled task using: