Azman
Azman

Reputation: 43

Adding "Successors" columns using VBA

How do I set an additional column in MS Project?

I tried the record macro option and copy-pasted the code but still facing errors.

Sub addcolumn()
' Macro addcolumn
    SelectTaskColumn Column:="Add New Column"
    TableEditEx Name:="&Entry", TaskTable:=False, NewName:="", FieldName:="Text1", NewFieldName:="Successors", Title:="", ColumnPosition:=8
    TableApply Name:="&Entry"
End Sub

Receive this error:

Run-time error '1004':
The field "Successors" does not exist.

Upvotes: 1

Views: 236

Answers (1)

Rachel Hettinger
Rachel Hettinger

Reputation: 8442

Since Successors is a Task field, the second argument needs to be True:

TableEditEx Name:="&Entry", TaskTable:=True, NewName:="", FieldName:="Text1", NewFieldName:="Successors", Title:="", ColumnPosition:=8

See Application.TableEditEx method for more details.

Upvotes: 1

Related Questions