Home > database >  MSProject - adding "Successors" columns using VBA
MSProject - adding "Successors" columns using VBA

Time:04-22

Sorry if this looks simple but unfortunately i am not able to find anywhere in setting additional column in MS Project. I did try record macro option and copy-paste 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.

Appreciate some guidance here. Thanks.

CodePudding user response:

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.

  • Related