Udostępnij za pośrednictwem


Application.TimescaleEdit Method (Project)

Enables changing the scale and format of a timescale in a Gantt chart or other timephased view.

Syntax

expression .TimescaleEdit(MajorUnits, MinorUnits, MajorLabel, MinorLabel, MajorAlign, MinorAlign, MajorCount, MinorCount, MajorTicks, MinorTicks, Enlarge, Separator, MajorUseFY, MinorUseFY, TopUnits, TopLabel, TopAlign, TopCount, TopTicks, TopUseFY, TierCount)

expression A variable that represents an Application object.

Parameters

Name

Required/Optional

Data Type

Description

MajorUnits

Optional

Variant

Time units for the middle timescale tier. Specify with the PjTimescaleUnit enumeration. The default value is pjTimescaleWeeks (3).

MinorUnits

Optional

Variant

Time units for the bottom timescale tier. Specify with the PjTimescaleUnit enumeration. The default value is pjTimescaleDays (2).

MajorLabel

Optional

Variant

Date or time labels for the middle timescale tier. Specify with one of the following enumerations: PjDateLabel, PjDayLabel, PjMonthLabel, or PjWeekLabel. The default value is pjWeekLabelWeek_mmm_dd_yyy (13). For example, default values are Mar 7, '10 and Mar 14, '10.

MinorLabel

Optional

Variant

Date or time labels for the bottom timescale tier. Specify with one of the following enumerations: PjDateLabel, PjDayLabel, PjMonthLabel, or PjWeekLabel. The default value is pjDayLabelDay_di (20). For example, default values are S, M, and T.

MajorAlign

Optional

Variant

The PjAlignment enumeration specifies how to align labels within each time period of the middle tier. The default is value is pjLeft (0).

MinorAlign

Optional

Variant

The PjAlignment enumeration specifies how to align labels within each time period of the bottom tier. The default is value is pjLeft (0).

MajorCount

Optional

Variant

Specifies the time unit interval in which to show labels for the middle tier. For example, if the time unit is weeks, a value of 1 shows a label every week; a value of 2 shows a label every two weeks.

MinorCount

Optional

Variant

Specifies the time unit interval in which to show labels for the bottom tier. For example, if the time unit is hours, a value of 1 shows a label every hour; a value of 2 shows a label every two hours.

MajorTicks

Optional

Variant

Specifies whether to show tick marks that separate time periods in the middle tier. For example, if the time unit is days, a value of False removes the tick marks between days.

MinorTicks

Optional

Variant

Specifies whether to show tick marks that separate time periods in the bottom tier. For example, if the time unit is hours, a value of False removes the tick marks between hours.

Enlarge

Optional

Variant

Specifies the percent of horizontal expansion of the timescale. For example, a value of 150 expands the timescale 150%.

Separator

Optional

Variant

Specifies whether to show the lines that separate the top, middle, and bottom tiers of the timescale. For example, a value of False removes the lines.

MajorUseFY

Optional

Variant

Specifies whether to base the middle tier labels on the fiscal year. The default value is False.

MinorUseFY

Optional

Variant

Specifies whether to base the bottom tier labels on the fiscal year. The default value is False.

TopUnits

Optional

Variant

Time units for the top timescale tier. Specify with the PjTimescaleUnit enumeration. The default value is pjTimescaleMonths (2).

TopLabel

Optional

Variant

Date or time labels for the top timescale tier. Specify with one of the following enumerations: PjDateLabel, PjDayLabel, PjMonthLabel, or PjWeekLabel. The default value is pjDayLabelDay_di (20). For example, default values are S, M, and T.

TopAlign

Optional

Variant

The PjAlignment enumeration specifies how to align labels within each time period of the top tier. The default is value is pjLeft (0).

TopCount

Optional

Variant

Specifies the time unit interval in which to show labels for the top tier. For example, if the time unit is months, a value of 1 shows a label every month; a value of 2 shows a label every two months.

TopTicks

Optional

Variant

Specifies whether to show tick marks that separate time periods in the top tier. For example, if the time unit is months, a value of False removes the tick marks between months.

TopUseFY

Optional

Variant

Specifies whether to base the top tier labels on the fiscal year. The default value is False.

TierCount

Optional

Variant

Specifies the number of timescale tiers. The integer value 3 shows all three tiers; the value 2 is default and shows the middle and bottom tiers; the value 1 shows only the middle tier.

Return Value

Boolean

Remarks

To manually edit a timescale in Microsoft Project 2010, right-click the timescale, and then click Timescale. Executing the TimescaleEdit method without any parameters brings up the Timescale dialog box. If the user clicks Cancel, TimescaleEdit returns False. If the user makes valid changes and clicks OK, TimescaleEdit returns True.

Example

The following example sets the timescale to three tiers, where the top tier units are months, the top labels are the month name and year, the middle tier units are weeks, and the middle tier labels are the month and day numbers. For example, top tier labels are March 2010 and April 2010 , and middle tier labels are 2/28 and 3/7 .

TimescaleEdit TierCount:=3, _ 
 TopUnits:=PjTimescaleUnit.pjTimescaleMonths, _ 
 TopLabel:=PjMonthLabel.pjMonthLabelMonth_mmmm_yyyy, _ 
 MajorUnits:=PjTimescaleUnit.pjTimescaleWeeks, _ 
 MajorLabel:=PjWeekLabel.pjWeekLabelWeek_mm_dd

Note

Values for the label time range in the TopLabel, MajorLabel, and MinorLabel parameters must be compatible with the time unit of the specified timescale tier. For example, if the time unit of the bottom tier is hours, the parameter value MinorLabel:=PjDateLabel.pjHour_hhAM is valid. However, the parameter value MinorLabel:=PjDateLabel.pjHalfYear_hhh_Half results in the run time error 1101: "The argument value is not valid."