【问题标题】:Ms Project 2007 Adding Custom Field Gantt (doesn't appear)Ms Project 2007 添加自定义字段甘特图(不出现)
【发布时间】:2020-07-01 07:35:46
【问题描述】:

使用此代码:

Sub CreateNewField()

Dim x As TableField
Dim Field As String

Field = "TestCustomField"

'Check if the Custom Field is already created
If (CustomFieldExists(Field) = True) Then
    MsgBox ("The Field Exists")
'If the Custom field doesn't exists
Else
    MsgBox ("Doesn't exist")
    CustomFieldRename FieldID:=pjTaskNumber1, NewName:=Field
    'Adding to the table
    Set x = ActiveProject.TaskTables(Application.ActiveProject.CurrentTable).TableFields.Add(pjTaskNumber1)

End If
'Calculate and adding graphical indicator to the Custom Field
CalculateCustomField (Field)
AddGraphicIndicator (Field)
End Sub

代码正确修改了自定义字段“数字 1”并将其添加到表中,但在我关闭 Project 并再次重新打开它之前,它在甘特图中看起来不像一个列。 是否有另一种方法可以在甘特图中显示自定义字段而无需关闭并重新打开 Project 2007 文件?

【问题讨论】:

    标签: vba ms-project


    【解决方案1】:

    这绝对是一个老帖子了,但它仍然可能有用的答案。

    我遇到了同样的问题,我想将现有字段“工作”添加到“条目”表中。我设法添加了它,但它没有显示在表格中。

    现在,要应用更改,我只需调用 TableApply 方法再次打开表:

    appProj.TableEditEx "Entry", True, , , , , "Work"
    appProj.TableApply "Entry"

    对我来说很好用。

    【讨论】:

    • 您好 Aurélien,是的,这已经很老了,但我感谢有人回答这个疑问。它可能对其他用户有用!感谢您的帮助。
    【解决方案2】:

    这篇文章有点老了,所以也许你已经继续前进了,但是你计算过项目并确保 Application.ScreenUpdating = True 吗?

    【讨论】:

    • 感谢您的回答,我不再使用 VBA,不幸的是我无法访问该文件来检查您的答案,但我希望这可以帮助将来遇到同样问题的任何人。再次感谢! :)
    猜你喜欢
    • 1970-01-01
    • 2013-05-28
    • 1970-01-01
    • 2010-09-06
    • 1970-01-01
    • 2016-09-23
    • 2013-03-30
    • 1970-01-01
    • 2019-06-17
    相关资源
    最近更新 更多