在 VBA Microsoft Project 2010 中遍历 Resource Graph 视图并使用资源名称导出到 XPS
Iterate through Resource Graph view and export to XPS with resources name in VBA Microsoft Project 2010
我正在尝试遍历资源图,一次查看一个资源,并使用与文件关联的适当名称导出到 XPS。
这是代码:
Sub ResourcGraph()
' Macro Macro4
' Macro Recorded Tue 6/9/15 by Valencia, Jonathan.
Dim Res As Resource
ViewApply "Resource Graph"
SelectBeginning
For Each Res In ActiveProject.Resources
If Not Res Is Nothing Then
DocumentExport FileName:=Res.Name & "Graph", FileType:=pjXPS
End If
SelectCellRight
Next Res
End Sub
这段代码迭代得很好。我遇到的问题是获取名称 correct.The 文件是由资源命名的,但是当我单击该文件时,它是错误的资源。有没有办法从 Resource Graph 视图中提取活动资源的信息,而不是像我现在这样浏览资源?
这可能是由于 Resource Graph 的排序顺序与 Resource 集合中的资源不同。您可以使用“查找”命令将图形移动到正确的资源,而不是尝试同步它们。
Sub ResourcGraph()
Dim Res As Resource
ViewApply "Resource Graph"
For Each Res In ActiveProject.Resources
If Not Res Is Nothing Then
FindEx Field:="Name", Test:="equals", Value:=Res.name, Next:=True
DocumentExport FileName:=Res.name & "Graph", FileType:=pjXPS
End If
Next Res
End Sub
我正在尝试遍历资源图,一次查看一个资源,并使用与文件关联的适当名称导出到 XPS。 这是代码:
Sub ResourcGraph()
' Macro Macro4
' Macro Recorded Tue 6/9/15 by Valencia, Jonathan.
Dim Res As Resource
ViewApply "Resource Graph"
SelectBeginning
For Each Res In ActiveProject.Resources
If Not Res Is Nothing Then
DocumentExport FileName:=Res.Name & "Graph", FileType:=pjXPS
End If
SelectCellRight
Next Res
End Sub
这段代码迭代得很好。我遇到的问题是获取名称 correct.The 文件是由资源命名的,但是当我单击该文件时,它是错误的资源。有没有办法从 Resource Graph 视图中提取活动资源的信息,而不是像我现在这样浏览资源?
这可能是由于 Resource Graph 的排序顺序与 Resource 集合中的资源不同。您可以使用“查找”命令将图形移动到正确的资源,而不是尝试同步它们。
Sub ResourcGraph()
Dim Res As Resource
ViewApply "Resource Graph"
For Each Res In ActiveProject.Resources
If Not Res Is Nothing Then
FindEx Field:="Name", Test:="equals", Value:=Res.name, Next:=True
DocumentExport FileName:=Res.name & "Graph", FileType:=pjXPS
End If
Next Res
End Sub