Solved

Export Project Tasks assigned to a single individual

Posted on 2010-08-17
8
623 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
  • 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:
thausla 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
 
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Agile and Scrum have almost become synonymous. Have you wondered what's the difference? Scrum is just one way to be Agile. It is the most popular which leads to the common confusion. Agile actually refers to a philosophy shared by group of developme…
Recently Microsoft released a brand new function called CONCAT. It's supposed to replace its predecessor CONCATENATE. But how does it work? And what's new? In this article, we take a closer look at all of this - we even included an exercise file for…
This video walks the viewer through the process of creating Hyperlinks for the web and other documents. Select the "Insert" tab: Click "Hyperlink":  Type "http://" followed by a web address to reference a website or navigate to a document to ref…
The viewer will learn how to  create a slide that will launch other presentations in Microsoft PowerPoint. In the finished slide, each item launches a new PowerPoint presentation and when each is finished it automatically comes back to this slide: …

758 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now