Basically as the title suggest, I'm trying to iterate through a custom field, named "Text3" which is associated with "Task Owner", drop down filter one resource at a time. I am new at this so please bear with me.
Here is my code:
Sub Macro1()
' Macro Macro1
' Macro Recorded Fri 5/29/15 by Valencia, Jonathan.
' suppose to go down the task owner filtered list for each resource and
' print to xps
Dim res As resource, name As String
'apply the gantt view first
ViewApply name:="gantt chart"
'expand all tasks
OutlineShowAllTasks
'apply the late task filter
FilterApply name:="Late Tasks"
For Each res In ActiveProject.Resources
name = res.name
'apply filter to task owner as the resource
'checks to see if filter is set on the application first
If Not ActiveProject.AutoFilter Then
Application.AutoFilter
End If
Application.SetAutoFilter FieldName:="Text3", _
FilterType:=pjAutoFilterCustom, _
Test1:="contains", Criteria1:=name
'export to xps with the resources' name
DocumentExport FileName:=name, FileType:=pjXPS
Next res
End Sub
*************************************************************************
The problem I'm having is it's not setting up the filter for that certain resource and its just leaving it blank. It works if I give the criterial as e.g "john smith", but I'm trying to use the varible name as a string to iterate through all the resources.
Any help would be appreciated. Thanks.