运行-时间错误‘1004’:字段"Active"不存在
Run-Time error '1004': The field "Active" Does Not Exist
我在用户的 PC 上收到此错误。他们在 Windows 7 上使用 Project 2013。在我们自己的测试机器上,在 Windows 10 上使用 Project 2013,在 Windows 10 上使用 Project 2016,我们没有看到相同的错误。
到处都在抛出错误,但是 FilterEdit
在这里找到了一个例子:
Sub STAT_Leads_Preds()
FilterEdit Name:="STAT_Leads_Preds", TaskFilter:=True, Create:=True, OverwriteExisting:=True, FieldName:="Predecessors", Test:="contains", Value:="-", ShowInMenu:=False, ShowSummaryTasks:=False
FilterEdit Name:="STAT_Leads_Preds", TaskFilter:=True, FieldName:="", NewFieldName:="Actual Finish", Test:="equals", Value:="NA", Operation:="And", ShowSummaryTasks:=False
If Not pActive Then
FilterEdit Name:="STAT_Leads_Preds", TaskFilter:=True, FieldName:="", NewFieldName:="Active", Test:="equals", Value:="Yes", Operation:="And", ShowSummaryTasks:=False
Else
End If
End Sub
不清楚为什么会出现此消息。 "Active" is, in fact, a field. 而且,就像我说的,我们在测试机器上没有看到这个问题。
作为参考,错误如下所示:
Project Standard 似乎没有 "Active" 字段。我们的解决方案涉及使用 Application.Edition 检查软件版本,可以是 one of two values:pjEditionProfessional
或 pjEditionStandard
.
代码的最终结果如下:
Sub STAT_Leads_Preds()
FilterEdit Name:="STAT_Leads_Preds", TaskFilter:=True, Create:=True, OverwriteExisting:=True, FieldName:="Predecessors", Test:="contains", Value:="-", ShowInMenu:=False, ShowSummaryTasks:=False
FilterEdit Name:="STAT_Leads_Preds", TaskFilter:=True, FieldName:="", NewFieldName:="Actual Finish", Test:="equals", Value:="NA", Operation:="And", ShowSummaryTasks:=False
If Not pActive And Application.Edition = pjEditionProfessional Then
FilterEdit Name:="STAT_Leads_Preds", TaskFilter:=True, FieldName:="", NewFieldName:="Active", Test:="equals", Value:="Yes", Operation:="And", ShowSummaryTasks:=False
Else
End If
End Sub
我在用户的 PC 上收到此错误。他们在 Windows 7 上使用 Project 2013。在我们自己的测试机器上,在 Windows 10 上使用 Project 2013,在 Windows 10 上使用 Project 2016,我们没有看到相同的错误。
到处都在抛出错误,但是 FilterEdit
在这里找到了一个例子:
Sub STAT_Leads_Preds()
FilterEdit Name:="STAT_Leads_Preds", TaskFilter:=True, Create:=True, OverwriteExisting:=True, FieldName:="Predecessors", Test:="contains", Value:="-", ShowInMenu:=False, ShowSummaryTasks:=False
FilterEdit Name:="STAT_Leads_Preds", TaskFilter:=True, FieldName:="", NewFieldName:="Actual Finish", Test:="equals", Value:="NA", Operation:="And", ShowSummaryTasks:=False
If Not pActive Then
FilterEdit Name:="STAT_Leads_Preds", TaskFilter:=True, FieldName:="", NewFieldName:="Active", Test:="equals", Value:="Yes", Operation:="And", ShowSummaryTasks:=False
Else
End If
End Sub
不清楚为什么会出现此消息。 "Active" is, in fact, a field. 而且,就像我说的,我们在测试机器上没有看到这个问题。
作为参考,错误如下所示:
Project Standard 似乎没有 "Active" 字段。我们的解决方案涉及使用 Application.Edition 检查软件版本,可以是 one of two values:pjEditionProfessional
或 pjEditionStandard
.
代码的最终结果如下:
Sub STAT_Leads_Preds()
FilterEdit Name:="STAT_Leads_Preds", TaskFilter:=True, Create:=True, OverwriteExisting:=True, FieldName:="Predecessors", Test:="contains", Value:="-", ShowInMenu:=False, ShowSummaryTasks:=False
FilterEdit Name:="STAT_Leads_Preds", TaskFilter:=True, FieldName:="", NewFieldName:="Actual Finish", Test:="equals", Value:="NA", Operation:="And", ShowSummaryTasks:=False
If Not pActive And Application.Edition = pjEditionProfessional Then
FilterEdit Name:="STAT_Leads_Preds", TaskFilter:=True, FieldName:="", NewFieldName:="Active", Test:="equals", Value:="Yes", Operation:="And", ShowSummaryTasks:=False
Else
End If
End Sub