Solved

Export Project Tasks assigned to a single individual

Posted on 2010-08-17
8
632 Views
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)
0
Comment
Question by:rgautier
[X]
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
8 Comments
 
LVL 10

Assisted Solution

by:SANTABABY
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).
0
 
LVL 12

Accepted Solution

by:
Dr. Thomas Henkelmann earned 250 total points
ID: 33462702
Hi,

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.

Regards

Thomas
0
 
LVL 13

Author Comment

by:rgautier
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.
0
Industry Leaders: 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!

 
LVL 13

Author Comment

by:rgautier
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.
0
 
LVL 13

Author Comment

by:rgautier
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.
0
 
LVL 13

Author Comment

by:rgautier
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 back....so 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

0
 
LVL 10

Assisted Solution

by:SANTABABY
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(workbookname,sheetname,assignment)
                'AddAssignment('<workbook Name>",RscName & "_tasks",TaskAsn)
            End If
        Next TaskAsn
    Next T
   

End Sub
0
 
LVL 13

Author Closing Comment

by:rgautier
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.
0

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

In this article, you will read about the trends across the human resources departments for the upcoming year. Some of them include improving employee experience, adopting new technologies, using HR software to its full extent, and integrating artifi…
This article describes how to import an Outlook PST file to Office 365 using a third party product to avoid Microsoft's Azure command line tool, saving you time.
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

728 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