Application.AddNewColumn method (Project)

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

Syntax

expression. AddNewColumn( _Column_ )

expression An expression that returns an Application object.

Parameters

Name Required/Optional Data type Description
Column Optional Variant Specifies the absolute column location. A value of 0 adds a column in the left-most position.

Return value

Boolean

Remarks

If the Column parameter is omitted, AddNewColumn inserts a column to the left of the active column, and displays [Type Column Name] in the column heading. By comparison, the ColumnInsert method displays the Field Settings dialog box for the new column.

Example

The following example selects the third column in the current view, and then adds a column to the right of the selected column. In the default Gantt Chart view, the third column is Task Name.

SelectColumn (2) 
AddNewColumn (3)

Note

If the user does not name the column header, AddNewColumn removes the selected column. When you add a column, it does not exist until the field is named. If you try to use the ColumnEdit method after AddNewColumn, Project shows run-time error 1100 (the command in the macro is not available in this situation).

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.