Tables of VBA Object Model Changes

Applies to: Office 2010 | Project 2010 | Project Server 2010 | SharePoint Server 2010

In this article
Comparison of Types
Object Model Changes in Project 2010
New Enumerations in Project 2010

The Microsoft Visual Basic for Applications (VBA) object model in Microsoft Project Standard 2010 and Microsoft Project Professional 2010 includes new classes, methods, properties, and enumerations that support the new features in Project 2010. For an introduction to the Project object model changes and the major new features, see Project Client Programming.

You can use the following sections to help develop or update automation solutions by using the Project 2010 object model. For more detailed information, see VBA Help in Project 2010 for each object or member.

  • Comparison of Types   Table 1 compares the VBA, Microsoft .NET Framework, and managed code types to help when you are developing with Microsoft Visual Studio Tools for Office.

  • Object Model Changes in Project 2010   Table 2 through Table 9 list all of the new objects and members in the subclasses of MSProject, arranged in functional groups.

    Note

    The tables of functional groups show generally related methods and properties. The functionality of a member can overlap the arbitrary groups.

    • Scheduling   Manually scheduled and inactive tasks; the Task Inspector; and new properties on task, resource, and assignment objects

    • Grouping, Sorting, and Filtering   Grouping and related operations for sheet views

    • Styles   Bar, grid, cell, and user interface customization

    • Views   Manipulation of views; adding columns; modifying tables

    • Editing   Replace, set, select, and similar operations

    • Comparing Projects   Operations related to the new feature for comparing project versions

    • Data I/O   Publishing; import and export; SharePoint interoperability

    • Miscellaneous Settings   Other general options and settings

  • New Enumerations in Project 2010   Table 10 lists new enumerations and new member constants in Project 2010 and shows which class members use them.

The detailed object model reference is available in the VBA Help reference, which includes an alphabetical list of new members by object. VBA Help includes descriptions, remarks, and examples. The Project 2010 SDK does not include the full VBA Help reference. To access VBA Help, open the Visual Basic Editor (VBE) in Project, and then click the Help icon or press F1. The VBA Help file is the Microsoft Help 2.0 format WINPROJ.DEV.HXS file in the [Program Files]\Microsoft Office\Office14\[LCID] directory, where LCID is the locale ID. For example, the English VBA Help for Project is [Program Files]\Microsoft Office\Office14\1033\WINPROJ.DEV.HXS.

Note

If the 32-bit version of Project 2010 is installed on a 64-bit Windows operating system, the WINPROJ.DEV.HXS file is in C:\Program Files (x86)\Microsoft Office\Office14\1033.

VBA Help for all Office 2010 client applications is also available through Office Online and in the MSDN Library. To access updated help topics when you are working in the VBE, click the Connection Status menu in the bottom-right corner of the Project Help window, and then click Show content from Office Online. For the fields reference for Project 2010 on Office.com, see Available fields.

Comparison of Types

Table 1 includes only the data types that you are likely to use when developing with the Project object model. For a list of built-in types, see the Microsoft Visual C# Types Reference Tables, the Visual Basic Data Type Summary, and other references in Visual Studio Help.

Table 1. Comparison of types

VBA Type
(in Project VBA)

.NET Framework
Base Type

Visual C# Alias
or Type

Visual Basic Alias

Byte

System.Byte

byte

Byte

Integer

System.Int16

short

Short

Long

System.Int32

int

Integer

LongLong Available only in 64-bit applications.
New in Microsoft Office 2010.

System.Int64

long

Long

LongPtr VBA alias. Available in 32-bit and 64-bit applications.
New in Microsoft Office 2010.

In 32-bit: System.Int32

In 64-bit: System.Int64

In 32-bit: int

In 64-bit: long

In 32-bit: Integer

In 64-bit: Long

Boolean

System.Boolean

Boolean

Boolean

Single

System.Single

float

Single

Double

System.Double

double

Double

String

System.String

string

String

Variant (for dates)

System.DateTime

DateTime

Date

Variant or Object

System.Object

object

Object

To create user-defined types that can be accessed by Declare statements, change pointers and handles from Long to LongPtr, and mark the Declare statement as pointer-safe. Because Microsoft Office 2010 applications use Visual Basic for Applications 7.0, you can use the #if VBA7 compiler to distinguish between Microsoft Office 2010 applications and Microsoft Office 2007 or previous versions. For example, the following code for an external function pointer could be used in 64-bit Office 2010 applications, 32-bit Microsoft Office 2007 applications, and previous versions.

#if VBA7 Then
Declare PtrSafe Function MyFunction Lib "my32BitLib.dll" (_
    ByVal Key As LongPtr, ByVal SubKey As String, NewKey As LongPtr) _
    As Long
#else
Declare Function MyFunction Lib "my32BitLib.dll" (_
    ByVal Key As Long, ByVal SubKey As String, NewKey As Long) _
    As Long
#endif

For code that can distinguish 32-bit from 64-bit applications, use the #if Win64 compiler constant. The following example can run on 32-bit Project 2010, 64-bit Project 2010, and Office Project 2007.

 Option Explicit

#If Win64 Then
    Private Declare PtrSafe Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As LongLong)
#Else
    Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
#End If

Sub SleepSome(time As Long)
    Dim edition As String
    Dim version As String
    
    If (Application.edition = 0) Then
        edition = "Standard"
    Else
        edition = "Professional"
    End If
    
    version = Application.version

#If Win64 Then
    Dim millisec As LongLong
    millisec = CLngLng(time)
    Debug.Print vbTab & "Running on 64-bit Project " & edition & " " & version
#Else
    Dim millisec As Long
    millisec = time
    Debug.Print vbTab & "Running on 32-bit Project " & edition & " " & version
#End If
    
    Sleep (millisec)
End Sub

Sub TestSleep()
    Dim millisec As Long
    millisec = 3800
    
    Debug.Print "Sleeping..."
    SleepSome (millisec)
    Debug.Print "Slept " & CStr(millisec / 1000) & " seconds"
End Sub

For more information, see Office Talk: Working with VBA in the 32-bit and 64-bit Versions of Office 2010.

Note

Many of the properties that the Object Browser shows as type Variant are internally of type Boolean. However, they are listed as Variant because they can be set with String, Integer, or Boolean values. For example, you can set the Task.Marked property to "Yes", 1, or True. It is generally best to use the Boolean values for clearer meaning and to make it easier to port code to Microsoft Visual Basic or Microsoft Visual C#.

Object Model Changes in Project 2010

The following tables list only additions in the Project 2010 object model compared to the Project 2007 object model. The Properties and Methods column show the new object members. There are no new events. Project 2010 hides the deleted members that were visible and documented in Project 2007. To see hidden members in the VBE, right-click anywhere in the Object Browser window and then click Show Hidden Members.

Note

Many of the methods that have changed parameters have Ex (for Extended) appended to the method name. When you record a macro in Project 2010, the macro uses the changed methods. For example, if you are recording a macro and close the project file, the macro records FileCloseEx. Hidden members are not documented in the Project 2010 VBA Help file.

The Comments/Description column shows the same description that is available in VBA Help. When you are using a method with a long list of parameters, use named parameters in VBA to help reduce errors. For example, OptionsViewEx has ProjectCurrency as the tenth parameter, between the CurrencyDigits and DisplayOutlineNumber parameters. You can pass a named parameter as shown in the following code example.

Dim result as Boolean
result = OptionsView DisplayOutlineNumber:=True
'Error in tenth parameter: 
'result = OptionsView( , , , , , , , , , True)

The tables in this article do not show the method signatures as extracted from the MSPRJ.OLB object library that is installed with Project Professional 2010. See VBA Help for the method signatures. The property types in the tables are named as they appear in the VBE.

The updated Visual Basic Help for Project 2010 shows the correct signature syntax for methods. For example, Figure 1 shows the syntax of the OpenFromSharePoint method.

Figure 1. Syntax example in VBA Help

Syntax example in VBA Help

For methods with a Boolean return value, the method returns True if it succeeds and False if it does not succeed.

All Project classes are in the MSProject library. The Application class members are also included in the hidden Global class in the VBE. The object library, MSPRJ.OLB, includes the Application class and the Global class.

Scheduling

Table 2 shows new members for manually scheduled tasks, inactive tasks, the Task Inspector, and related properties on task, resource, and assignment objects.

Table 2. Object model changes for project scheduling

Class

Properties and Methods

Comments / Description

Application

Boolean ChangeStatusDate method

Changes the project status date.

Application

Boolean ClearConstraint method

Clears the constraint on a specified task.

Application

Boolean InactivateTaskToggle method

Toggles the state of a task between inactive and active.

Application

Boolean InsertBlankRow method

Inserts a blank row above the selected task row or cell in a Gantt chart.

Application

Boolean InsertManualTask method

Inserts a new manually scheduled task above the selected task row or cell in a Gantt chart.

Application

Boolean InsertMilestoneTask method

Inserts a new milestone task above the selected task row or cell in a Gantt chart.

Application

Boolean InsertResource method

Inserts a new resource in a resource view.

Application

Boolean InsertScheduledTask method

Inserts a new automatically scheduled task above the selected task row or cell in a Gantt chart.

Application

Boolean InsertSummaryTask method

Inserts a new summary task above the selected task row or cell in a Gantt chart.

Application

Boolean InsertTask method

Inserts a new task of the default mode above the selected task row or cell in a Gantt chart.

Application

Property: LevelFreeformTasks as Boolean

True if manually scheduled tasks are leveled; otherwise, false.

Application

Boolean LevelingOptionsEx method

Specifies leveling options for the active project, including leveling of manually scheduled tasks.

Application

Boolean LevelSelected method

Levels the selected tasks to resolve resource conflicts or overallocations.

Application

Boolean NewTasksStartOn method

Specifies how the start date of a new task is set.

Application

Boolean ProjectMove method

Moves the project start date to a new date.

Application

Boolean ReassignSelectedAssns method

Reassigns the selected assignments in the Team Planner view.

Application

SelectTaskAssns method

Selects all assignments for a selected task in the Team Planner view.

Application

Boolean SetResourceFieldByID method

Sets the value of a resource field specified by the field identification number.

Application

Boolean SetShowTaskSuggestions method

Sets the global Show Suggestions option for tasks.

Application

Boolean SetShowTaskWarnings method

Sets the global Show Warnings option for tasks.

Application

Boolean SetTaskFieldByID method

Sets the value of a task field specified by the field identification number

Application

Boolean SetTaskMode method

Changes the mode of the selected tasks, to manually scheduled or automatically scheduled.

Application

Boolean ShowIgnoredTaskWarnings method

Shows any ignored warnings for tasks; turns on the warning symbol in the Indicators column.

Application

Boolean TaskInspector method

Displays the Task Inspector pane.

Application

Boolean TaskMove method

Moves the start date of one or more selected tasks the specified number of days.

Application

Boolean TaskMoveToStatusDate method

Moves completed or incomplete parts of one or more selected tasks to the status date.

Application

Boolean TaskRespectLinks method

Moves one or more selected tasks so that their dates are determined by their task dependencies.

Application

Boolean TogglePreventResOveralloc method

Toggles the Prevent Overallocations command for the Team Planner view.

Application

Boolean ToggleResourceDetails method

Shows or hides the Resource Form in the bottom pane of a split view.

Application

Boolean ToggleTaskDetails method

Shows or hides the Task Form in the bottom pane of a split view.

Assignment

Replan method

Replans the assignment by decreasing work or increasing duration.

Assignment

Property: Resource As Resource

Gets the resource associated with the assignment.

Assignment

Property: Task As Task

Gets the task associated with the assignment.

Cell

Property: Assignment As Assignment

Gets the assignment associated with the cell.

OverAllocatedAssignments

Property: Count As Long

Gets the number of Assignment objects in the OverAllocatedAssignments collection.

OverAllocatedAssignments

Property: Item As Assignment

Gets a single Assignment object from the OverAllocatedAssignments collection.

OverAllocatedAssignments

Property: TotalDetectedCount As Long

Gets the total number of overallocated assignments, including those that exceed maximum resource time available.

Project

Property: DetectCycle As Tasks

Gets a Tasks collection that contains a set of circular task dependencies, if circular task references exist.

Project

Property: KeepTaskOnNearestWorkingTimeWhenMadeAutoScheduled As Boolean

True if task scheduling respects the current calendar when a task is converted from manual to automatic; otherwise, false.

Project

Property: ManuallyScheduledTasksAutoRespectLinks As Boolean

True if predecessor and successor task links are maintained when a task is converted from automatic to manual; otherwise, false.

Project

Property: NewTasksCreatedAsManual As Tasks

True if new tasks are created as manually scheduled tasks. False if new tasks are automatically scheduled.

Project

Property: ShowTaskSuggestions As Tasks

True if task suggestions in the active project are displayed; otherwise, false.

Project

Property: ShowTaskWarnings As Tasks

True if task warnings in the active project are displayed; otherwise, false.

StartDriver

Property: EffectiveDateAdd As Variant

Gets the date and time that follows another date by a specified duration, by using the effective calendar for a manually scheduled task.

StartDriver

Property: EffectiveDateDifference As Long

Gets the duration between two dates in minutes, by using the effective calendar for a manually scheduled task.

StartDriver

Property: EffectiveDateSubtract As Variant

Gets the date and time that precedes another date by a specified duration, by using the effective calendar for a manually scheduled task.

StartDriver

Property: OverAllocatedAssignments As OverAllocatedAssignments

Gets overallocated assignments for a task start driver.

StartDriver

Property: Suggestions As Long

Gets a combination of PjTaskWarnings values that indicate whether there are potential problems that should be fixed for a specified task.

StartDriver

Property: Warnings As Long

Gets a combination of PjTaskWarnings values that indicate whether there are problems for a specified task.

Task

Property: Active As Variant

True if the task is active; otherwise, false.

Task

Property: Baseline[n]DurationText As String

Gets or sets a string representation of the baseline duration of a task. [n] can be 1–10 or empty.

Task

Property: Baseline[n]FinishText As String

Gets or sets a string representation of the baseline finish date of a task. ([n] can be 1–10 or empty.)

Task

Property: Baseline[n]StartText As String

Gets or sets a string representation of the baseline start date of a task. ([n] can be 1–10 or empty.)

Task

Property: CalendarObject As Calendar

Gets the Calendar object to be used when scheduling the task.

Task

Property: DurationText As String

Gets or sets a string representation of the task duration.

Task

Property: FinishText As String

Gets or sets a string representation of the task finish date.

Task

Property: IgnoreWarnings As Variant

True if task warnings are ignored when processing the task; otherwise, false.

Task

Property: IsDurationValid As Variant

True if the task duration is valid; otherwise, false.

Task

Property: IsFinishValid As Variant

True if the task finish date is valid; otherwise, false.

Task

Property: IsStartValid As Variant

True if the task start date is valid; otherwise, false.

Task

Property: Manual As Variant

True if task recalculation is set to Manually Scheduled. False if task recalculation is set to Auto Schedule.

Task

Property: Placeholder As Variant

True if the task is a placeholder for another task; otherwise, false.

Task

Property: ScheduledDuration As Variant

Gets or sets the scheduled (as opposed to actual) duration of a task.

Task

Property: ScheduledFinish As Variant

Gets or sets the scheduled (as opposed to actual) finish time of a task.

Task

Property: ScheduledStart As Variant

Gets or sets the scheduled (as opposed to actual) start time of a task.

Task

Property: StartText As String

Gets or sets a string representation of the task start date.

Task

Property: Warning As Variant

Gets the active warning for a task.

Grouping, Sorting, and Filtering

Table 3. Object model changes for grouping, sorting, and filtering

Class

Properties and Methods

Comments / Description

Application

Boolean FilterClear method

Removes any filter that is set on the current view.

Application

Boolean FilterNew method

Shows the Filter Definition dialog box, where the user can create a filter for a task-based view, resource-based view, or the default view filter.

Application

Boolean FilterShowSummaryRows method

Shows or hides the related summary rows.

Application

Boolean FindEx method

Searches for an unfiltered value in a specified field or in all available fields; returns True if the value is found.

Application

Boolean GroupClear method

Removes the current group from the view.

Application

Boolean GroupMaintainHierarchy method

Shows or hides item hierarchy in task views or resource views where a group is applied.

Application

Boolean GroupNew method

Displays the Group Definition dialog box.

Application

Boolean SetAutoFilter method

Sets the criteria for an AutoFilter for a specified field in a sheet view.

Cell

Property: Assignment As Assignment

Gets the assignment associated with the cell.

Group2

N/A

New class. Represents a group definition where the group hierarchy can be maintained. A Group2 object is a member of a Groups2, ResourceGroups2, or TaskGroups2 collection.

Group2

Delete method

Deletes the Group2 object from a Groups2 collection.

Group2

Property: GroupAssignments as Boolean

True if assignments are grouped, instead of tasks or resources.

Group2

Property: GroupCriteria as GroupCriteria2

Gets or sets the GroupCriteria2 collection representing the fields in a group definition.

Group2

Property: Index As Long

Gets the index in a ResourceGroups2 collection or TaskGroups2 collection.

Group2

Property: MaintainHierarchy As Boolean

Gets or sets a value that specifies whether hierarchy is maintained in the group view.

Group2

Property: Name As String

Gets or sets the name of a Group2 object.

Group2

Property: ShowSummary As Boolean

True if summary tasks are displayed in a task view that is organized by group; otherwise, false.

Groups2

N/A

New class. Represents a collection of Group2 objects, which can maintain group hierarchy.

Groups2

Group2 Add method

Adds a Group2 object to a Groups2 collection.

Groups2

Group2 Copy method

Makes a copy of a group definition in the Groups2 collection.

Groups2

Property: Count As Long

Gets the number of Group2 objects in the collection.

Groups2

Property: Item As Group2

Gets a Group2 object from the collection.

GroupCriterion2

N/A

New class. Represents a criterion in a group definition where the group hierarchy can be maintained and cell color can be a hexadecimal value.

GroupCriterion2

Delete method

Deletes the GroupCriterion2 object from a GroupCriteria2 collection.

GroupCriterion2

Property: Ascending As Boolean

True if a field that is used as a criterion is sorted in ascending order.

GroupCriterion2

Property: Assignment As Boolean

True if the assignment should be grouped according to the Customize Group By dialog box when you group in a usage view. Read/write Boolean.

GroupCriterion2

Property: CellColor As PjColor

Gets or sets the color of the cell background for a field that is used as a criterion.

GroupCriterion2

Property: CellColorEx As Long

Gets or sets the color of the cell background, where the color can be a hexadecimal value.

GroupCriterion2

Property: FieldName As String

Gets or sets the name of the field being grouped by.

GroupCriterion2

Property: FieldName As String

Gets or sets the name of the field being grouped by.

GroupCriterion2

Property: FieldName As String

Gets or sets the name of the field being grouped by.

GroupCriterion2

Property: FieldName As String

Gets or sets the name of the field being grouped by.

GroupCriterion2

Property: Index As Long

Gets the index in a GroupCriteria2 collection.

GroupCriteria2

N/A

New class. Contains a collection of GroupCriterion2 objects, where the group hierarchy can be maintained and cell color can be a hexadecimal value.

GroupCriteria2

GroupCriterion2 Add method

Adds a GroupCriterion2 object to the collection.

GroupCriteria2

GroupCriterion2 AddEx method

Adds a GroupCriterion2 object to the collection, where CellColor can be a hexadecimal value.

GroupCriteria2

Property: Count As Long

Gets the number of GroupCriterion2 objects in the collection.

GroupCriteria2

Property: Item As GroupCriterion2

Gets a GroupCriterion2 object from the collection.

Project

Property: ResourceGroups2 As ResourceGroups2

Gets a ResourceGroups2 collection representing all the resource groups based on Group2 objects.

Project

Property: TaskGroups2 As TaskGroups2

Gets a TaskGroups2 collection representing all the resource groups based on Group2 objects.

ResourceGroups2

N/A

New class. Represents all of the resource-based group definitions, where group hierarchy can be maintained.

ResourceGroups2

Group2 Add method

Adds a Group2 object to a ResourceGroups2 collection.

ResourceGroups2

Group2 Copy method

Makes a copy of a group definition in the ResourceGroups2 collection.

ResourceGroups2

Property: Count As Long

Gets the number of Group2 objects in the ResourceGroups2 collection.

ResourceGroups2

Property: Item As Group2

Gets a Group2 object from the ResourceGroups2 collection.

TaskGroups2

N/A

New class. Represents all the task-based group definitions, where group hierarchy can be maintained.

TaskGroups2

Group2 Add method

Adds a Group2 object to a TaskGroups2 collection.

TaskGroups2

Group2 Copy method

Makes a copy of a group definition in the TaskGroups2 collection.

TaskGroups2

Property: Count As Long

Gets the number of Group2 objects in the TaskGroups2 collection.

TaskGroups2

Property: Item As Group2

Gets a Group2 object from the TaskGroups2 collection.

Styles

Table 4. Object model changes for styles and user interface elements

Class

Properties and Methods

Comments / Description

Application

Boolean BoxCellEditEx Method

Sets the properties of an individual cell in a data template for a Network Diagram view (PERT chart), where the font color can be specified with a hexadecimal value.

Application

Boolean BoxFormatEx Method

Formats individual boxes in the Network Diagram view, where colors can be specified with hexadecimal values.

Application

Boolean BoxLayoutEx Method

Specifies the layout of boxes in the active Network Diagram view, where the background color can be specified as a hexadecimal value.

Application

Boolean BoxLinksEx Method

Specifies the appearance of link lines in the active Network Diagram view, where colors can be hexadecimal values.

Application

Boolean BoxStylesEditEx Method

Sets the style of boxes in the Network Diagram view, where colors can be hexadecimal values.

Application

Boolean CalendarBarStylesEditEx Method

Changes the style of the specified type of bar in the Calendar view, where color can be a hexadecimal value.

Application

Boolean CalendarDateBoxesEx Method

Customizes the top and bottom bands of date boxes in the Calendar view, where color can be a hexadecimal value.

Application

Boolean CalendarDateShadingEditEx Method

Changes the background color and pattern of date boxes in the Calendar view, where color can be a hexadecimal value.

Application

Boolean ChangeColumnDataType Method

Changes the data type of a local custom field column in a table.

Application

Boolean EditTPStyle Method

Edits the box and border colors of different types of tasks in the Team Planner view.

Application

Boolean Font32Ex Method

Sets the font for the text in the active cells, where the text color can be a hexadecimal value.

Application

Boolean FontStrikethrough Method

Applies or removes strikethrough formatting from the selected text.

Application

Boolean GanttBarEditEx Method

Changes or creates a Gantt bar style, where colors can be hexadecimal values.

Application

Boolean GanttBarFormatEx Method

Changes the formatting of Gantt bars from their default styles, where colors can be hexadecimal values.

Application

Boolean GanttBarStyleBaseline Method

Shows or hides the specified baseline on Gantt bars of the active view.

Application

Boolean GanttBarStyleCritical Method

Shows or hides the critical tasks style on the active Gantt chart.

Application

Boolean GanttBarStyleLate Method

Shows or hides the late tasks style on the active Gantt chart.

Application

Boolean GanttBarStyleSlack Method

Shows or hides the slack style for tasks on the active Gantt chart.

Application

Boolean GanttBarStyleSlippage Method

Shows or hides slippage for the specified baseline on Gantt bars of the active view.

Application

Boolean GridlinesEditEx Method

Edits gridlines, where colors can be hexadecimal values.

Application

Boolean ResetTPStyle Method

Resets the specified Team Planner style to the default values.

Application

Boolean ResourceGraphBarStylesEx Method

Sets the styles of bars on the Resource Graph view, where colors can be hexadecimal values.

Application

Boolean SegmentBorderColor Method

Sets the border color for the assignment segments of a selected task in the Team Planner view.

Application

Boolean SegmentFillColor Method

Sets the fill color for the assignment segments of a selected task in the Team Planner view.

Application

Boolean TextStyles32Ex Method

Sets the text styles for tasks and resources in the active view, where colors can be hexadecimal values.

Application

Boolean WrapText Method

Cell

Property: CellColorEx As Long

Gets or sets the RGB color of the cell background.

Cell

Property: FontColorEx As Long

Gets or sets the hexadecimal (RGB) color of the font.

Project

Property: FollowedHyperlinkColorEx As Long

Gets or sets the hexadecimal color of a followed hyperlink.

Project

Property: HyperlinkColorEx As Long

Gets or sets the hexadecimal color of a hyperlink.

Project

SetCustomUI Method

Sets the internal XML value for a custom ribbon user interface of the project.

Views

Table 5. Object model changes for views

Class

Properties and Methods

Comments / Description

Application

Boolean AddNewColumn Method

Adds a new column in a specified position, in views where columns can be added.

Application

Boolean DetailsPaneToggle Method

Shows or hides the task or resource Details pane for the selected item.

Application

Boolean DetailStylesFormatEx Method

Sets the format of timescaled data fields in a Resource Usage view or Task Usage view, where colors can be hexadecimal values.

Application

Boolean FilePageSetupCalendarTextEx Method

Formats the text of calendar views for printing, where the text color can be a hexadecimal value.

Application

Boolean FilePageSetupLegendEx Method

Creates a legend for printing views of task data, where color can be a hexadecimal value.

Application

Property: PanZoomFinish as Variant

Gets or sets the finish date of the Gantt chart view after a pan or zoom operation.

Application

Boolean PanZoomPanTo method

Pans the Gantt chart in the active view to the specified start date.

Application

Property: PanZoomStart As Variant

Gets or sets the start date of the Gantt chart view after a pan or zoom operation.

Application

Boolean PanZoomZoomTo method

Zooms the time range in or out for the Gantt chart in the active view.

Application

Boolean ShowAddNewColumn method

Shows or hides the Add New Column column at the right side of the active sheet view.

Application

Boolean TableCopy method

Makes a copy of the active table, adds it to the Tables drop-down menu, and sets the view to use the new table.

Application

Boolean TableEditEx method

Creates, edits, or copies a table that can wrap text and that can include the Add New Column feature.

Application

Boolean TableReset method

Resets the active table to the default table definition.

Application

Boolean TaskOnTimeline method

Manages tasks on the Timeline pane or for a specified custom timeline.

Application

Boolean TimelineFormat method

Formats the Timeline view to specify the number of text lines in timeline tasks and whether to show or hide details.

Application

Boolean TimelineGotoSelectedTask method

When a task is selected in the Timeline view, selects the same task in the main view.

Application

Boolean TimelineInsertTask method

When the Timeline view is selected, displays the Task Information dialog box, and then inserts a new task into the project and adds the task to the Timeline view.

Application

Boolean TimelineShowHide method

Shows or hides the specified feature in the Timeline view.

Application

Boolean TimelineTextOnBar method

Changes the format of text to display as a callout or within the Timeline bar, for one or more selected tasks.

Application

Boolean TimelineViewToggle Method

Shows or hides the Timeline view.

Application

Property: TimescaleFinish as Variant

Gets or sets the date and time that the timescale in the current view ends.

Application

Boolean TimescaleNonWorkingEx method

Sets the format of nonworking times, where color values can be hexadecimal values.

Application

Property: TimescaleStart as Variant

Gets or sets the date that the timescale in the current view starts.

Application

Boolean ToggleResourceDetails method

Shows or hides the Resource Form in the bottom pane of a split view.

Application

Boolean ToggleTaskDetails method

Shows or hides the Task Form in the bottom pane of a split view.

Application

Boolean ToggleTPAutoExpand method

Expands or collapses resource rows in the Team Planner view, where there is more than one assignment within the same time span for a resource.

Application

Boolean ToggleTPResourceExpand method

Expands or collapses the specified resource row in the Team Planner view, when there is more than one assignment within the same time span.

Application

Boolean ToggleTPUnassigned method

Shows or hides the Unassigned Tasks section in the Team Planner view.

Application

Boolean ToggleTPUnscheduled method

Shows or hides the Unscheduled Tasks column in the Team Planner view.

Application

Boolean UsageViewEntryEx method

Adds fields to the Details pane and option menu for the Task Usage or Resource Usage views, and formats the styles to help distinguish detail rows.

Application

Boolean ViewApplyEx method

Applies a view to the active window, where the change can be one of the built-in views and can be applied to a specified pane in a split view.

Application

Boolean ViewCopy method

Copies the current view.

Application

Boolean ViewReset method

Resets the current view back to the global view definition.

Application

Boolean ViewsEx method

Displays the More Views dialog box with the specified pane of the current view selected, which prompts the user to manage views.

Project

SetCustomUI Method

Sets the internal XML value for a custom ribbon user interface of the project.

Editing

Table 6. Object model changes for editing

Class

Properties and Methods

Comments / Description

Application

Boolean ReplaceEx method

Searches for an unfiltered value in a specified field or in all available fields and replaces it with the specified value. Returns True if any replacements are made.

Application

Boolean SelectToEnd method

For the selected assignment in the Team Planner view, selects from the beginning to the end of assignments for that resource.

Application

Boolean SelectTPLineHeight method

Sets the number of text lines for assignment rows in the Team Planner view.

Application

Boolean SelectTPTask method

Selects the specified task in the Team Planner view.

Application

Boolean SetTPField method

Sets a value for the percent complete field of one or more tasks in the Team Planner view.

Comparing Projects

Table 7. Object model changes for comparing projects

Class

Properties and Methods

Comments / Description

Application

Boolean CloseComparison method

Closes the project version comparison report.

Application

Property: CompareProjectsCurrentVersionName As String

Gets or sets the name of the current version of a project for a comparison of project versions.

Application

Boolean CompareProjectsLegendToggle method

Shows or hides the legend in a project version comparison report.

Application

Property: CompareProjectsPreviousVersionName As String

Gets or sets the name of the previous version of a project for a comparison of project versions.

Application

Boolean CompareProjectVersions method

Displays the Compare Project Versions dialog box to compare two versions of a project.

Application

Boolean CreateComparisonReport method

Creates a comparison report between two versions of a project.

Application

Boolean GoToItemInVersions method

For the selected item in a project version comparison report, highlights that item in each version.

Application

Boolean ResourceComparison method

In a project comparison report, shows the Resource Sheet view in all three project plans, to compare resources.

Application

Boolean TaskComparison method

In a project comparison report, shows the Gantt Chart view in all three project plans, to compare tasks.

Data I/O

Table 8. Object model changes for data I/O

Class

Properties and Methods

Comments / Description

Application

Boolean DocumentExport method

Exports the active project as a document in PDF or XPS format.

Application

Boolean ManageSiteColumns method

Displays the Manage Fields dialog box, which enables synchronizing built-in fields and custom fields in a local project with specified columns in a SharePoint tasks list.

Application

Boolean OpenFromSharePoint method

Opens a project from a SharePoint task list.

Application

Boolean OpenServerPage method

Opens the specified page from Project Server.

Application

Boolean ShareProjectOnline method

Saves the active project to a SharePoint site.

Application

Boolean SynchronizeWithSite method

Synchronizes a local project with a tasks list on a SharePoint site.

Application

Boolean TaskDeliverableCreate method

Creates or removes a deliverable for the selected task.

Application

Boolean TaskDeliverableSync method

Synchronizes selected task deliverables in the active project with changes made in Project Web App.

Application

Boolean TaskDependencySync method

Synchronizes task dependencies in the active project with changes in deliverables from other projects.

Application

Boolean TimelineExport method

Copies an image of the active Timeline view to the Clipboard, for pasting into other applications.

Project

ExportAsFixedFormat method

Exports the active project as a PDF or XPS document, using a custom format.

Miscellaneous Settings

Table 9. Object model changes for miscellaneous settings

Class

Properties and Methods

Comments / Description

Application

Boolean AutoSaveToGlobal method

Specifies whether to automatically add new views, field templates, filters, and groups to the global template (Global.mpt).

Application

Property: Build As String

Gets the version and build number of Microsoft Project.

Application

Boolean CleanupProjectfromCache method

Deletes the specified project file from the local cache.

Application

Boolean OptionsEditEx method

Sets options for Project 2010, where colors can be hexadecimal values, or opens the Project Options dialog box.

Application

Boolean OptionsSecurityTab method

Displays a specific tab of the Trust Center dialog box in Project 2010.

Application

Boolean ShareProjectOnline method

Opens the URL for information about sharing projects in the Share with Project Online section in the Backstage view.

New Enumerations in Project 2010

Table 10 shows the new enumerations and member constants. To find the values of constants, see the enumeration in the VBA Object Browser. VBA Help includes the values and definitions of constants.

Table 10. New enumerations and constants in Project 2010

Enumeration

Constants

Where Used / Comments

PjAssignmentReplanAction

pjConstrainToMaxUnitsByDecreasingWork,
pjConstrainToMaxUnitsByIncreasingDuration

Assignment.Replan

New enumeration. Specifies the replan action for assignments.

PjAutoFilterType

pjAutoFilter1DayOrLess,
pjAutoFilter1WeekOrLonger,
pjAutoFilter40HoursOrMore,
pjAutoFilter8HoursOrLess,
pjAutoFilterBetween,
pjAutoFilterBetween1DayAnd1Week,
pjAutoFilterBetween8And40Hours,
pjAutoFilterClear,
pjAutoFilterComplete,
pjAutoFilterContains,
pjAutoFilterCustom,
pjAutoFilterEndsWith,
pjAutoFilterEquals,
pjAutoFilterFlagNo,
pjAutoFilterFlagYes,
pjAutoFilterGreaterThan,
pjAutoFilterGreaterThan0Cost,
pjAutoFilterIn,
pjAutoFilterInProgress,
pjAutoFilterLastMonth,
pjAutoFilterLastQuarter,
pjAutoFilterLastWeek,
pjAutoFilterLastYear,
pjAutoFilterLessThan,
pjAutoFilterNextMonth,
pjAutoFilterNextQuarter,
pjAutoFilterNextWeek,
pjAutoFilterNextYear,
pjAutoFilterNoDate,
pjAutoFilterNoDuration,
pjAutoFilterNotContains,
pjAutoFilterNotEquals,
pjAutoFilterNotStarted,
pjAutoFilterNoWork,
pjAutoFilterPhonetic0,
pjAutoFilterPhonetic1,
pjAutoFilterPhonetic10,
pjAutoFilterPhonetic2,
pjAutoFilterPhonetic3,
pjAutoFilterPhonetic4,
pjAutoFilterPhonetic5,
pjAutoFilterPhonetic6,
pjAutoFilterPhonetic7,
pjAutoFilterPhonetic8,
pjAutoFilterPhonetic9,
pjAutoFilterThisMonth,
pjAutoFilterThisQuarter,
pjAutoFilterThisWeek,
pjAutoFilterThisYear,
pjAutoFilterToday,
pjAutoFilterTomorrow,
pjAutoFilterWithin1And25Percent,
pjAutoFilterWithin26And50Percent,
pjAutoFilterWithin51And75Percent,
pjAutoFilterWithin76And100Percent,
pjAutoFilterYearToDate,
pjAutoFilterYesterday

Application.SetAutoFilter

New enumeration. Specifies how to set the automatic filter.

PjCompareVersionColumns

pjCompareVersionColumnsDataAndDifferences,
pjCompareVersionColumnsDataOnly,
pjCompareVersionColumnsDifferencesOnly

CreateComparisonReport

New enumeration. Specifies how to compare views of project versions.

PjCompareVersionItems

pjCompareVersionItemsAllDifferences,
pjCompareVersionItemsAllItems,
pjCompareVersionItemsChangedItems,
pjCompareVersionItemsCommonItems,
pjCompareVersionItemsUnchangedItems,
pjCompareVersionItemsUniqueItemsOfVersion1,
pjCompareVersionItemsUniqueItemsOfVersion2

CreateComparisonReport

New enumeration. Specifies how to compare items when comparing two project versions.

PjDocExportType

pjPDF,
pjXPS

DocumentExport

New enumeration. Specifies the type of document export.

PjField

pjTaskActive,
pjTaskAssignmentPeakUnits,
pjTaskBaseline10DurationText,
pjTaskBaseline10FinishText,
pjTaskBaseline10StartText,
pjTaskBaseline1DurationText,
pjTaskBaseline1FinishText,
pjTaskBaseline1StartText,
pjTaskBaseline2DurationText,
pjTaskBaseline2FinishText,
pjTaskBaseline2StartText,
pjTaskBaseline3DurationText,
pjTaskBaseline3FinishText,
pjTaskBaseline3StartText,
pjTaskBaseline4DurationText,
pjTaskBaseline4FinishText,
pjTaskBaseline4StartText,
pjTaskBaseline5DurationText,
pjTaskBaseline5FinishText,
pjTaskBaseline5StartText,
pjTaskBaseline6DurationText,
pjTaskBaseline6FinishText,
pjTaskBaseline6StartText,
pjTaskBaseline7DurationText,
pjTaskBaseline7FinishText,
pjTaskBaseline7StartText,
pjTaskBaseline8DurationText,
pjTaskBaseline8FinishText,
pjTaskBaseline8StartText,
pjTaskBaseline9DurationText,
pjTaskBaseline9FinishText,
pjTaskBaseline9StartText,
pjTaskBaselineDurationText,
pjTaskBaselineFinishText,
pjTaskBaselineStartText,
pjTaskDuration,
pjTaskDurationText,
pjTaskFinish,
pjTaskFinishText,
pjTaskIgnoreWarnings,
pjTaskIsDurationValid,
pjTaskIsFinishValid,
pjTaskIsStartValid,
pjTaskManual,
pjTaskPlaceholder,
pjTaskScheduledDuration,
pjTaskScheduledFinish,
pjTaskScheduledStart,
pjTaskStart,
pjTaskStartText,
pjTaskWarning

Many properties, methods, and events use the PjField enumeration. For example, see the GetField method, SetField method, FieldConstantToFieldName method, and the FieldNameToFieldConstant method.

Specifies a resource or task field. Includes the new pjTask*Text fields, such as pjTaskStartText. Those fields are used to get data for dates of both automatically and manually scheduled tasks.

PjFieldTypes

pjCostField,
pjDateField,
pjDurationField,
pjFinishField,
pjFlagField,
pjNumberField,
pjStartField,
pjTextField

ChangeColumnDataType

New enumeration. Specifies the type of custom field.

PjFileFormat

pjMPP12,
pjMPP9,
pjXLSB,
pjXLSX

FileSaveAs

Specifies the file format.

PjFilterViewType

pjFilterViewTypeResource,
pjFilterViewTypeTask,
pjFilterViewTypeUseView

FilterNew

New enumeration. Specifies the type of filter for a view.

PjLevelSelectedOption

pjResolveForResource,
pjResolveForSelectedResources,
pjResolveNextAvailableTime,
pjResolveSelectedTasks

LevelSelected

New enumeration. Specifies the leveling option.

PjNewTasksStartOnDate

pjCurrentDate,
pjNoDate,
pjProjectDate

NewTasksStartOn

New enumeration. Specifies the type of date that new tasks start on.

PjOptionsSecurityTab

pjOptionsSecurityTabAddins,
pjOptionsSecurityTabLegacy,
pjOptionsSecurityTabMacro,
pjOptionsSecurityTabPrivacy,
pjOptionsSecurityTabProjectServer,
pjOptionsSecurityTabPublishers

OptionsSecurityTab

New enumeration. Specifies the tabs for settings available in the Trust Center dialog box.

PjOverallocationType

pjOverallocationTypeAboveMaxUnits,
pjOverallocationTypeNone,
pjOverallocationTypeWorkingInNonWorkingTime,
pjOverallocationTypeWorkingOnOtherTasks

OverAllocatedAssignments

New enumeration. Specifies the type of resource overallocation.

PjPasteSpecialType

pjHTMLData,
pjUnformattedHTMLData

EditPasteSpecial

Specifies the type of object to paste or link.

PjServerPage

pjServerPageApprovals,
pjServerPageDocuments,
pjServerPageIssues,
pjServerPagePermissions,
pjServerPagePortfolioAnalyzer,
pjServerPageProjectCenter,
pjServerPageProjectDetails,
pjServerPageResourceCenter,
pjServerPageRisks,
pjServerPageStatusReports,
pjServerPageWorkspace

OpenServerPage

New enumeration. Specifies the page to show in Project Server or in a project site.

PjServerVersionInfo

pjServerVersionInfo_P14,
pjServerVersionInfo_P12,
pjServerVersionInfo_P11

GetProjectServerVersion

Specifies how to format data from Project Server versions.

PjTaskWarnings

pjTaskWarningResourceOverallocated,
pjTaskWarningShadowDateDifferent,
pjTaskWarningShadowFinishesEarlierDueToLink,
pjTaskWarningShadowFinishesLaterDueToLink,
pjTaskWarningShadowIncorrectByConstraintOnly,
pjTaskWarningShadowIncorrectByLevelingDelayOnly,
pjTaskWarningSubTaskFinishingAfterParentFinish,
pjTaskWarningTaskFinishingInNonWorkingTime,
pjTaskWarningSubTaskStartingAfterParentStart,
pjTaskWarningSubTaskStartingBeforeParentStart,
pjTaskWarningTaskStartingInNonWorkingTime,
pjTaskWarningSummaryInconsistentFinish,
pjTaskWarningSummaryInconsistent

StartDriver.Warnings

New enumeration. Specifies warnings for tasks or assignments.

PjTeamPlannerStyle

pjTaskWarningResourceBeyondMaxUnit,
pjTPActualWork,
pjTPLateTask,
pjTPManualTask,
pjTPScheduledWork,
pjTPSRA

EditTPStyle and ResetTPStyle

New enumeration. Specifies the Team Planner style to edit.

PjTimelineInsertTaskType

pjTimelineInsertCalloutTask,
pjTimelineInsertMilestone,
pjTimelineInsertTask

TimelineInsertTask

New enumeration. Specifies the type of task to insert on the Timeline view.

PjTimelineShowHide

pjTimelineShowHidePanZoom,
pjTimelineShowHideTaskDates,
pjTimelineShowHideTaskOverlaps,
pjTimelineShowHideTimescale,
pjTimelineShowHideToday

TimelineShowHide

New enumeration. Toggles the visibility of parts of the Project 2010 timeline.

PjViewScreen

pjResourceScheduling,
pjTimeline

ViewsSingle.Add

Specifies the screen type for a view.

PjViewType

pjViewBarRollup,
pjViewCalendar,
pjViewDescriptiveNetworkDiagram,
pjViewDetailGantt,
pjViewGantt,
pjViewGanttWithTimeline,
pjViewLevelingGantt,
pjViewMilestoneDateRollup,
pjViewMilestoneRollup,
pjViewMultipleBaselinesGantt,
pjViewNetworkDiagram,
pjViewRelationshipDiagram,
pjViewResourceAllocation,
pjViewResourceForm,
pjViewResourceGraph,
pjViewResourceNameForm,
pjViewResourceSchedulingView,
pjViewResourceSheet,
pjViewResourceUsage,
pjViewTaskDetailsForm,
pjViewTaskEntry,
pjViewTaskForm,
pjViewTaskNameForm,
pjViewTaskSheet,
pjViewTaskUsage,
pjViewTimeline,
pjViewTrackingGantt,
pjViewUndefined

ViewApplyEx

New enumeration. Specifies a view in Project 2010.

PjVisualReportsDataLevel

pjLevelAutomatic ,
pjLevelDays,
pjLevelMonths,
pjLevelQuarters,
pjLevelWeeks,
pjLevelYears

VisualReportsEdit, VisualReportsNewTemplate, VisualReportsSaveCube, VisualReportsSaveCube, and VisualReportsView methods.

Specifies the time level of data to use in Visual Reports..

See Also

Reference

Data Type Summary

Concepts

VBA Object Model Changes

Other Resources

Project Client Programming

Types Reference Tables

Office Talk: Working with VBA in the 32-bit and 64-bit Versions of Office 2010

Available fields