Table of contents
TOC
折叠目录
展开目录

Application.DurationFormat 方法 (项目)Application.DurationFormat Method (Project)

office 365 dev account|上次更新日期: 2018/3/13
|
2 参与人员

以指定的单位返回工期。Returns a duration in the specified units.

语法Syntax

表达式DurationFormat(* 持续时间单位)expression. **DurationFormat( ** Duration, ** Units* )

表达式_一个表示应用程序对象的变量。_expression A variable that represents an Application object.

参数Parameters

名称Name必需/可选Required/Optional数据类型Data Type说明Description
DurationDuration必需RequiredVariantVariant要表示的工期。The duration to be expressed.
"单位"Units可选OptionalLongLong用于表示此持续时间的单位。可以是PjFormatUnit常量之一。The units used to express the duration. Can be one of the PjFormatUnit constants.

返回值Return Value

StringString

注解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".

例如,如果_持续时间_"2w",单位_是pjDays,和日期显示为:设置为"日期", DurationFormat方法将返回"10 天"。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
© 2018 Microsoft