none
Setting Task Start and Finish Dates/Times with VBA

    Pertanyaan

  • Title says what I'm trying to do, but I can't seem to get it to work. With each attempt, I tried to make it be less and less dynamic until I finally just tried this:

    ActiveCell.Task.SetField pjTaskStart, "06/14/2018 8:30:00 AM"

    and

    ActiveCell.Task.SetField pjTaskStart, "06/14/2018"

    The result for both is the error "The argument value is not valid."

    I'm sure I'm missing something simple and obvious, and I feel bad for having to ask, but I just can't seem to figure out what I'm doing wrong. Everything I've found while searching seems to indicate these should work. :S

    14 Juni 2018 15:47

Jawaban

  • And I figured it out. I didn't add detection for parent tasks whose dates are determined by the subtasks. I modified it to test if there are subtasks.

    With ActiveCell.Task
        If .OutlineChildren.Count = 0 Then
            .SetField pjTaskStart, "06/14/2018 8:30:00 AM"
            .SetField pjTaskFinish, "08/09/2018 5:00:00 PM"
        End If
    End With

    14 Juni 2018 16:08