Task to be done in one go i.e. few hours meeting RRS feed

  • Question

  • I looked for it and didn't find an answer. I want to auto-schedule a meeting, asap after other task, however to be planned as in one go. Currently it is doing 1h on Fri and 2h on Mon. I would prefer to have 3h on Mon then or move to Fri if other task will get shorter. I didn't figured out how to do it yet. Anyone?
    Thursday, October 24, 2013 6:05 AM

All replies

  • Mr KK,

    I don't know of an easy way to do this without using a macro but maybe someone else has an idea. Meanwhile, the following macro will do what you need. It makes a couple assumptions. First, the meeting tasks in question do not have their own task calendar. Second, each meeting task that you want to be continuous is identified using the Flag1 field. The code could be made more general to work around these assumptions but for a quick start, this will work.

    'This macro ensures all selected tasks can be completed continuously once started.
    '   Tasks are selected by setting Flag1. Note: this procedure does leave a
    '   start-no-earlier-than constraint on all shifted tasks
    'written by John 10/24/13 8:00 am
    Dim t As Task
    Dim EndTime As String, StartTime As String, ProjCal As String
    Dim WkD As Integer
    Dim DayDate As Date
    Sub NextDayB()
    'cycle through each task
    ProjCal = ActiveProject.Calendar
    For Each t In ActiveProject.Tasks
        'skip over blank lines
        If Not t Is Nothing Then
            'only look at Start time of non-summary tasks
            If t.Summary = False And t.Flag1 = True Then
                'find default start and end times for this task
                WkD = Weekday(t.Start)
                StartTime = ActiveProject.BaseCalendars(ProjCal).WeekDays(WkD).Shift1.Start
                EndTime = ActiveProject.BaseCalendars(ProjCal).WeekDays(WkD).Shift2.Finish
                'create faux end date & time if task ended the same date it started
                DayEnd = DateValue(t.Start) & " " & EndTime
                If Application.DateDifference(t.Start, DayEnd) < t.Duration Then
                    'task won't finish the same day so move it to start first thing next working day
                    t.Start = DateValue(Application.DateAdd(t.Start, "1d")) & " " & StartTime
                End If
            End If
        End If
    Next t
    End Sub

    Hope this helps.


    • Edited by John - Project Friday, October 25, 2013 4:20 PM updated code
    Thursday, October 24, 2013 4:45 PM