Showing results 1 to 4 of 4

Thread: modify Scheduler with VBA

  1. #1
    rloureiro Gast

    Default 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.

  2. #2

    Default 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
    End Sub

  3. #3
    rloureiro Gast

    Default Re: modify Scheduler with VBA

    Iīm gone test the example that you give and thank you for the excellent help.

  4. #4
    Join Date

    Default Re: modify Scheduler with VBA


    Is it possible for you to provide an example to read data from the schedule, like Switch on off times and dates?

    Thank you in advance

Posting Rules

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts