Solved

Export Project Tasks assigned to a single individual

Posted on 2010-08-17
8
625 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
NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

 
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

No matter the version of Windows you are using, you may have some problems with Windows Search running too slow or possibly not running at all. Before jumping into how you can solve this issue, just know there are many other viable alternative deskt…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
The viewer will learn how to simulate a series of coin tosses with the rand() function and learn how to make these “tosses” depend on a predetermined probability. Flipping Coins in Excel: Enter =RAND() into cell A2: Recalculate the random variable…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

810 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