Share via


Application.TableEditEx Method (Project)

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

Version Information

Version Added: Project 2010

Syntax

expression .TableEditEx(Name, TaskTable, Create, OverwriteExisting, NewName, FieldName, NewFieldName, Title, Width, Align, ShowInMenu, LockFirstColumn, DateFormat, RowHeight, ColumnPosition, AlignTitle, HeaderAutoRowHeightAdjustment, HeaderTextWrap, WrapText, ShowAddNewColumn)

expression An expression that returns an Application object.

Parameters

Name

Required/Optional

Data Type

Description

Name

Required

String

The name of a table to edit, create, or copy.

TaskTable

Required

Boolean

True if the active table contains information about tasks or resources; otherwise, False.

Create

Optional

Boolean

True if Project creates a table; otherwise, False. If NewName is not defined, the new table is given the name specified with Name. Otherwise, the new table is a copy of the table specified with Name and is given the name specified with NewName. The default value is False.

OverwriteExisting

Optional

Boolean

True if an existing table is overwritten with the new table; otherwise, False. The default value is False.

NewName

Optional

String

The new name for the existing table (Create is False) or new table (Create is True). If NewName is not defined and Create is False, the table specified with Name retains its current name. The default value is an empty string ("").

FieldName

Optional

String

The name of a field to change.

NewFieldName

Optional

String

The name of a new field. The field specified with NewFieldName replaces the field specified with FieldName.

Title

Optional

String

The title for the field specified with FieldName.

Width

Optional

Integer

A number that specifies the width of the field specified with FieldName. The default value is 10 for new fields.

Align

Optional

Integer

Specifies how to align the text in the field specified with FieldName. Can be one of the following PjAlignment constants: pjLeft, pjCenter, or pjRight. The default value is pjRight.

ShowInMenu

Optional

Boolean

True if the table name appears in the Tables drop-down menu; otherwise, False. (The Tables drop-down menu is on the View tab on the Ribbon.) The default value is False.

LockFirstColumn

Optional

Boolean

True if Project locks or prevents changes to the first column of the table; otherwise, False. The default value is False.

DateFormat

Optional

Integer

A constant that specifies the format for the date fields in the table. Can be one of the PjDateFormat constants. The default value is pjDateDefault.

RowHeight

Optional

Integer

The height of the rows in the table. The default value is 1.

ColumnPosition

Optional

Long

The number of the column to edit. (Columns are numbered from left to right, starting with 0.) If a value for NewFieldName is specified, a new column is inserted in the table. If ColumnPosition is set to 0, the new field is inserted in the first column (LockFirstColumn is False) or the second column (LockFirstColumn is True) of the table. Set ColumnPosition to -1 to specify the last column of the table. The default value is -1.

AlignTitle

Optional

Long

A constant that specifies the alignment of the column title. Can be one of the following PjAlignment constants: pjLeft, pjCenter, or pjRight. The default value is pjCenter.

HeaderAutoRowHeightAdjustment

Optional

Boolean

True if Project automatically adjusts the row height of the table; otherwise, False. The default value is True.

HeaderTextWrap

Optional

Boolean

True if Project wraps text in the header of the table; otherwise, False. The default value is True.

WrapText

Optional

Boolean

True if the table wraps text in the rows; otherwise, False.

ShowAddNewColumn

Optional

Boolean

True if the table shows the Add New Column feature in the far-right column; otherwise, False.

Return Value

Boolean

Remarks

Project sets the order of years, months, and days in a date format equal to the corresponding value in the Regional and Language Options dialog box of the Windows Control Panel.

To make a copy of the active table, see the TableCopy method.

Example

The following example creates a table based on the Task Usage table, includes the Add New Column feature, and adds the table to the Table drop-down menu. The macro adds the Priority field as the second column with a title and width of 12, changes the default date format, and then makes the new table the active view.

Sub CreateNewTaskUsageTable() 
 TableEditEx Name:="Usage", TaskTable:=True, Create:=True, _ 
 NewName:="Priority Tasks", ShowAddNewColumn:=True 
 
 TableEditEx Name:="Priority Tasks", TaskTable:=True, _ 
 NewFieldName:="Priority", Title:="Priority", Width:=12, _ 
 ShowInMenu:=True, DateFormat:=pjDate_mm_dd_yy, _ 
 ColumnPosition:=1 
 
 TableApply "Priority Tasks" 
End Sub