TableEdit Method

Creates, edits, or copies a table.

Syntax

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

*expression   *     Optional. An expression that returns an Application object.

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.

Create    Optional Boolean. True if Project should create a new table. If NewName is Empty , 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 should be overwritten with a new one. The default value is False.

NewName    Optional String. A new name for the existing table (Create is False) or new table (Create is True). If NewName is Empty and Create is False, the table specified with Name retains its current name. The default value is Empty.

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 Long. A number that specifies the width of the field specified with FieldName. The default value is 10 for new fields.

Align    Optional Long. A constant that 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 menu. (The Tables menu appears when you click Table on the View menu.) The default value is False.

LockFirstColumn    Optional Boolean. True if Project should lock or prevent changes to the first column of the table. The default value is False.

PjDateFormat


Constant
Date format applied to 9/30/02 (12:33 PM)
pjDateDefault The default format, as specified on the View tab of the Options dialog box. (To open the Options dialog box, click Options on the Tools menu.)
pjDate_mm_dd_yy_hh_mmAM 9/30/02 12:33 PM
pjDate_mm_dd_yy 9/30/02
pjDate_mm_dd_yyyy 9/30/2002
pjDate_mmmm_dd_yyyy_hh_mmAM September 30, 2002 12:33 PM
pjDate_mmmm_dd_yyyy September 30, 2002
pjDate_mmm_dd_hh_mmAM Sep 30 12:33 PM
pjDate_mmm_dd_yyy Sep 30, '02
pjDate_mmmm_dd September 30
pjDate_mmm_dd Sep 30
pjDate_ddd_mm_dd_yy_hh_mmAM Tue 9/30/02 12:33 PM
pjDate_ddd_mm_dd_yy Tue 9/30/02
pjDate_ddd_mmm_dd_yyy Tue Sep 30, '02
pjDate_ddd_hh_mmAM Tue 12:33 PM
pjDate_mm_dd 9/30
pjDate_dd 30
pjDate_hh_mmAM 12:33 PM
pjDate_ddd_mmm_dd Tue Sep 30
pjDate_ddd_mm_dd Tue 9/30
pjDate_ddd_dd Tue 30
pjDate_Www_dd W41/2
pjDate_Www_dd_yy_hh_mmAM W41/2/02 12:33 PM

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 the 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's 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.

HeaderTextWrap    Optional Boolean. Boolean. True if Project wraps text in the header of the table.

Remarks

Project sets the order of the items in a date format (such as years, months, and days) equal to the corresponding value in the Regional Settings icon (in Windows 98, Windows NT, or Windows Me), Regional Options icon (in Windows 2000), or Regional and Language Options icon (in Windows XP) of the Microsoft Windows Control Panel.

Example

The following example creates a new table based on the Task Usage table and adds it to the Table menu. It 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()
    TableEdit Name:="Usage", TaskTable:=True, Create:=True, _
        NewName:="Priority Tasks"
        
    TableEdit 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

Applies to | Application Object

See Also | ColumnDelete Method | ColumnEdit Method | ResourceTableList Property | TableApply Method | Tables Method | TaskTableList Property