我很高兴与MS-Project合作,我在项目中添加了一些自定义字段,需要通过执行某些操作来更新其值在macros请建议我如何实现这个功能。
I am very new to work with MS-Project, i have added few custom fields in project and need to update their values by performing certain operations at macros please suggest me how can achieve this functionality.
谢谢,
C Mahone
推荐答案
C. Mahone,
C. Mahone,
您可以随时通过其字段名称引用任何自定义字段,或者您也可以通过"友好"字段引用它们。名称。例如,假设您已将任务Text1字段重命名为"Customers"字段。并且您希望将该字段值设置为"Costco"。对于活动项目中的任务ID 1。下面的第一种方法是通过普通字段名称来实现的。第二种方法是通过友好字段名称来完成的。
You can always refer to any custom field by its field name, or you also reference them by their "friendly" name. For example, let's say you've renamed the task Text1 field as "Customers" and you want to set that field value to be "Costco" for task ID 1 in the active project. The first method below does it via the normal field name. The second method does it via the friendly field name.
方法1:
Sub SetCustFieldVal() ActiveProject。任务(1).Text1 =" Costco" End Sub
Sub SetCustFieldVal() ActiveProject.Tasks(1).Text1 = "Costco" End Sub
方法2:
Sub SetCustFieldVal() Dim FldCst As String FldCst = FieldNameToFieldConstant(" customers",pjTask) ActiveProject.Tasks(1).SetField FieldID:= FldCst,Value:=" Costco" End Sub
Sub SetCustFieldVal() Dim FldCst As String FldCst = FieldNameToFieldConstant("customers", pjTask) ActiveProject.Tasks(1).SetField FieldID:=FldCst, Value:="Costco" End Sub
希望这会有所帮助。
John
更多推荐
处理宏的自定义字段?
发布评论