Export Project Tasks assigned to a single individual

Posted on 2010-08-17
Last Modified: 2012-05-10
I want to export the tasks assigned to a single individual to a separate Excel file.  Out of my very large project, I want to filter on the tasks assigned to an individual and then Export ONLY those tasks shown by the filter to an Excel file.

I already have my export map saved, but none of the filters in the Save map allow me to filter by tasks assigned to a single resource name.

How do I do this?  (preferably how do I do it in code...but I can record a macro if shown how to do it in the GUI)
Question by:rgautier
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 2
LVL 10

Assisted Solution

SANTABABY earned 250 total points
ID: 33460341
Have you tried creating a filter for your specific resource:
Resource Names          equals                <........>

and selected that filter in the export wizard?

-- Another approach is to use VBA to copy the required task attributes to a spreadsheet for a specified individual. (I have some samples, let me know if you need it).
LVL 12

Accepted Solution

Dr. Thomas Henkelmann earned 250 total points
ID: 33462702

in the export map you can select all task filters as in a gantt chart view. So why don't you just use the "Using resource" filter? When you finally save the Excel file based on this map you are being asked for the resource name you want to filter to.


LVL 13

Author Comment

ID: 33463689
What I need is while I am in VBA to basically do in a For loop -

Dim r as Resource
For r in ActiveProject.Resources
    :code I don't know here:
next r

Where that code does a SaveAs to Excel, after setting the filter to be the selected resource and the filename is a string based on the resource name.

thausla: I looked through the selectable filters in the map - none were by resource.
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

LVL 13

Author Comment

ID: 33464210
For example:

I tried recording a macro doing this, and it recorded only this entry:

FileSaveAs Name:="C:\Users\rich gautier\Desktop\myproject_myresource.xlsx", FormatID:="MSProject.ACE", map:="IMS_Export_Map"

Note that this line of code does NOT show me selecting the resourcename from the popup box during the save - which is the part that I need to automate.
LVL 13

Author Comment

ID: 33464283
Here is the closest I've gotten so far:
    Dim r As Resource
    Dim fn As String
    For Each r In ActiveProject.Resources
      MsgBox r.Name
      fn = "C:\Users\rich gautier\Desktop\MyProject_" & r.Name & ".xlsx"
      FileSaveAs Name:=fn, FormatID:="MSProject.ACE", map:="IMS_Export_Map"
    Next r

What this code does, though is display which Resource name to select in the upcoming selection box - and then I type it, or select it from the box....  I need some way for it to automatically select that resource name during the export(FileSaveAs) function.
LVL 13

Author Comment

ID: 33465167
Ok -  this did it for me:

//See attached code block

I used SendKeys to pad the keyboard buffer with the answer to the popup message (I know that I'm playing with fire with this)

If someone has a better solution, please let me know.  As thausla suggested, I did use the filter 'Using resource' - which I had not seen previously.

I'd also love to see SantaBaby's VB examples if he comes I'll leave this question open for a bit.

Sub SavewithFilter()
' Macro SavewithFilter
' Macro Recorded Wed 8/18/10 by rich gautier.
    Dim r As Resource
    Dim fn As String
    Dim KeyBuf As String
    For Each r In ActiveProject.Resources
      KeyBuf = r.Name & Chr(13)
      fn = "C:\Users\rich gautier\Desktop\Exports\MyProject_" & r.Name & ".xlsx"
      SendKeys KeyBuf
      FileSaveAs Name:=fn, FormatID:="MSProject.ACE", map:="IMS_Export_Map"
    Next r
End Sub

Open in new window

LVL 10

Assisted Solution

SANTABABY earned 250 total points
ID: 33468569
I was thinking about a brut force approach to open an Excel app and populate it using project VBA, something like the following:

Private Sub ExportTaskForIndividual(Optional RscName As String = "")

    Dim T As Task
    Dim TaskAsn As Assignment
    For Each T In ActiveProject.Tasks
         For Each TaskAsn In T.Assignments
            If RscName = "" Or TaskAsn.ResourceName = RscName Then
                'write a VBA function to add a record to an excel workkbook in the
                'resource specific worksheet
                'AddAssignment('<workbook Name>",RscName & "_tasks",TaskAsn)
            End If
        Next TaskAsn
    Next T

End Sub
LVL 13

Author Closing Comment

ID: 33474261
I was looking for a quick and simple solution to how to access the export functionality with VBA code that would auto-answer the asked questions or export with a filter than could be auto-configured in code.

While technically correct that I could use VBA code to manually export my data, I would have to recode the solution every time my template changed, which is not a good alternative.

I thank the experts for their inputs and awarded points  for both helping me get to my solution and providing alternatives.

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

My attempt to use PowerShell and other great resources found online to simplify the deployment of Office 365 ProPlus client components to any workstation that needs it, regardless of existing Office components that may be needing attention.
I was prompted to write this article after the recent World-Wide Ransomware outbreak. For years now, System Administrators around the world have used the excuse of "Waiting a Bit" before applying Security Patch Updates. This type of reasoning to me …
This video shows where to find the word count, how to display it, and what it breaks down to in Microsoft Word.

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question