Application.TableEditEx method (Project)
Creates, edits, or copies a table that can wrap text and include the Add New Column feature.
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 by Name. Otherwise, the new table is a copy of the table specified by Name and is given the name specified by 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 by 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 by NewFieldName replaces the field specified by FieldName. |
Title | Optional | String | The title for the field specified by FieldName. |
Width | Optional | Integer | A number that specifies the width of the field specified by FieldName. The default value is 10 for new fields. |
Align | Optional | Integer | Specifies how to align the text in the field specified by 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 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 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
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.