modify Scheduler with VBA
Sorry Mark one more question please!
Let me describe the steps that i have done.
1- I created the variable that i will use in the scheduler(Editor).
2- Then i created the switching point in the scheduler (Runtime).
3- Now what i want to do is to change the switch point (e.g. change the execution hour) in the scheduler without "touching" the scheduler element. I would like to do this with a VBA Script.
It´s possible? Could you tell me some more information please.
Thanks one more time. :)
Re: modify Scheduler with VBA
yes, you can modify the Scheduler via VBA. Please also see the VBA help for more information. Here you can find a small example:
Sub sched_change()
Dim myPfsGroup As PfsGroup
' Group 0 is the schedule of the Scheduler
Set myPfsGroup = thisProject.Pfs.Groups.Item(0)
If (Not myPfsGroup Is Nothing) Then
Dim mySchedItem As PfsSchedule
'Schedule item 0
Set mySchedItem = myPfsGroup.Schedules.Item(0)
End If
If Not (mySchedItem Is Nothing) Then
Dim mySched As PfsSchedule
'Scheduler Item 0 is the day for Monday in the schedule
Set mySched = mySchedItem.Schedules.Item(0)
End If
If (Not mySched Is Nothing) Then
Dim mySchedTimeOn As PfsScheduleTime
'in this case (Switch On / Switch Off), item 0 is the start time for the first time
Set mySchedTimeOn = mySched.ScheduleTimes.Item(0)
Debug.Print mySchedTimeOn.Time
mySchedTimeOn.Time = "01.01.1970 09:20:00"
Debug.Print mySchedTimeOn.Time
Dim mySchedTimeOff As PfsScheduleTime
'in this case (Switch On / Switch Off), item 0 is the end time for the first time
Set mySchedTimeOff = mySched.ScheduleTimes.Item(1)
Debug.Print mySchedTimeOff.Time
mySchedTimeOff.Time = "01.01.1970 09:22:00"
Debug.Print mySchedTimeOff.Time
End If
thisProject.Pfs.Save
End Sub
Re: modify Scheduler with VBA
I´m gone test the example that you give and thank you for the excellent help.
Regards.;)
Re: modify Scheduler with VBA
Hello,<br><br>Is it possible for you to provide an example to read data from the schedule, like Switch on off times and dates?<br><br>Thank you in advance