如果我对tmp
变量进行监视并且在If Not tmp Then
行停止,则两者都显示为true,即I.e. tmp
为True,Not tmp
为True。
Dim subProj As Subproject
For Each subProj In prj.Subprojects
Dim tmp As Boolean
tmp = subProj.IsLoaded
If Not tmp Then
ExportTaskToExcel subProj.SourceProject, StartDate, EndDate
End If
Next
如何检查主项目中是否未加载(未扩展)子项目?
Look at image under this link which is showing that in the same time: True = not True
答案 0 :(得分:0)
有可能你在其他地方声明了tmp,这可以从这里看到导致这个问题(即它在另一个模块中声明为public)。尝试更改名称以隔离它,同样,我以前从未在循环中声明变量,虽然我不确定其含义,但我不推荐它。
Dim subProj As Subproject
Dim tmp10 As Boolean
For Each subProj In prj.Subprojects
tmp10 = subProj.IsLoaded
If Not tmp10 Then
ExportTaskToExcel subProj.SourceProject, StartDate, EndDate
End If
Next
您可能出于特定原因而已完成此操作,但您可以完全省略该变量: -
Dim subProj As Subproject
For Each subProj In prj.Subprojects
If Not subProj.IsLoaded Then
ExportTaskToExcel subProj.SourceProject, StartDate, EndDate
End If
Next