ms office - Macro to iterate through a field filter one at a time using VBA Microsoft project 2010 -


basically title suggest, i'm trying iterate through custom field, named "text3" associated "task owner", drop down filter 1 resource @ time. new @ please bear me.

here code:


sub macro1() ' macro macro1 ' macro recorded fri 5/29/15 valencia, jonathan. ' suppose go down task owner filtered list each resource , ' print xps      dim res resource, name string      'apply gantt view first     viewapply name:="gantt chart"     'expand tasks     outlineshowalltasks     'apply late task filter     filterapply name:="late tasks"  each res in activeproject.resources     name = res.name       'apply filter task owner resource     'checks see if filter set on application first     if not activeproject.autofilter         application.autofilter     end if      application.setautofilter fieldname:="text3", _                 filtertype:=pjautofiltercustom, _                 test1:="contains", criteria1:=name       'export xps resources' name     documentexport filename:=name, filetype:=pjxps    next res   end sub ************************************************************************* 

the problem i'm having it's not setting filter resource , leaving blank. works if give criterial e.g "john smith", i'm trying use varible name string iterate through resources.

any appreciated. thanks.

per comments, code build list of unique names stored in text3 field , loop on them create xps reports.

sub createxpsreports()      ' build unique list of names store in text3     on error resume next     dim names new collection     dim tsk task     each tsk in activeproject.tasks         names.add tsk.text3, tsk.text3     next tsk      on error goto 0      'apply gantt view first     viewapply name:="gantt chart"     'expand tasks     outlineshowalltasks     'apply late task filter     filterapply name:="late tasks"      dim name variant     each name in names         'this line missing code work.         on error resume next                     'apply filter task owner resource         'checks see if filter set on application first         if not activeproject.autofilter             application.autofilter         end if          application.setautofilter fieldname:="text3", _                     filtertype:=pjautofiltercustom, _                     test1:="contains", criteria1:=name          'export xps resources' name         documentexport filename:=name, filetype:=pjxps      next name  end sub 

Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -