DurationFormat Method
Returns a duration in the specified units.
Syntax
expression**.DurationFormat(Duration, Units)**
*expression * Optional. An expression that returns an Application object.
Duration Required Variant. The duration to be expressed.
PjFormatUnit
pjDays | pjElapsedWeeks |
pjDaysEstimated | pjElapsedWeeksEstimated |
pjElapsedDays | pjHours |
pjElapsedDaysEstimated | pjHoursEstimated |
pjElapsedHours | pjMinutes |
pjElapsedHoursEstimated | pjMinutesEstimated |
pjElapsedMinutes | pjMonths |
pjElapsedMinutesEstimated | pjMonthsEstimated |
pjElapsedMonths | pjWeeks |
pjElapsedMonthsEstimated | pjWeeksEstimated |
Remarks
The time label that appears next to the duration uses the format specified by the timescale as: setting on the Edit tab of the Options dialog box, where timescale is "Minutes", "Hours", "Days", "Weeks", "Months", or "Years".
For example, if Duration is "2w", Units is pjDays, and the Days as: setting is "day", the DurationFormat method returns "10 days".
Example
The following example displays the duration of the selected task in weeks.
Sub DurationInWeeks()
MsgBox DurationFormat(ActiveCell.Task.Duration, pjWeeks)
End Sub
Applies to | Application Object
See Also | DurationValue Method