Select only visible tasks

S

SpaceCamel

I am trying to make a separate summary schedule file to send to someone. I
flagged then filtered the tasks I want on the detail schedule. But when I
select, copy and paste the tasks to a new file ALL the tasks in between are
copied as well. Does MSP have a command, like in Excel, to only select the
visible tasks? Is there any onther way to make a separate summary MSP File?

Thanks,
 
J

John

SpaceCamel said:
I am trying to make a separate summary schedule file to send to someone. I
flagged then filtered the tasks I want on the detail schedule. But when I
select, copy and paste the tasks to a new file ALL the tasks in between are
copied as well. Does MSP have a command, like in Excel, to only select the
visible tasks? Is there any onther way to make a separate summary MSP File?

Thanks,

SpaceCamel,
Copying and pasting a filtered set of tasks is a poor way to get what
you want. There are two basic problems, and probably more. First, if any
of the filtered set is a summary line, all the subtasks of that summary
will be pasted because you are telling it to paste the summary line and
regardless of the filter, all subtasks are part of the summary. The
second problem is with Predecessors and Successors. Links in the
filtered set are based on the task ID structure in the unfiltered file.
When a new file is created the ID structure starts from scratch and
therefore the link IDs from the pasted tasks is not compatible. If you
don't get an immediate error message about circular links, the file may
still be totally hosed, even if auto-calculation is turned off.

I assume you only want the person receiving the file to see or have
access to the filtered set of tasks. If that isn't the main concern then
the answer is obvious - send them the whole file and tell them which
filter to use. Otherwise, there are various approaches you can use. Two
come to mind immediately. One approach is to create a new file whose
tasks are linked to the main file using external predecessors. You may
have to break the links and add some constraints before sending since
the other person will not have the source file. Another approach is to
use VBA to create a new file from the filtered set. With code you can
account for the issues mentioned above.

Hope this helps.
John
Project MVP
 
P

Peter Rooney

Hi, John!,

I had a similar situation to this where I needed to create extract plans
containing subsets of data to send to various customers. Here's how I got
around it:

Create a new field in your plan which contains a unique identifier - I have
extra fields called "ProjectName" and "TeamName" - these contain, for every
applicable task, the name of the sub project, or the sub team within my
department that is carrying out the work.

You then create filters based on the contents of these fields - if you want
to filter just on the screen, make sure that "Show Related Summary Rows" is
checked - if you're copying to a new plan, leave it unchecked. Here's the
code I used to filter for one of several projects - you can see the filtering
taking place in the "FilterProjectPlan" macro.
There's also other stuff to save the filtered plans here - I save to two
places, my D drive and my network drive, and combine the curent date into the
filename - so, you can easily create multiple versions of your extracts,
based on the current date.

Hope this helps, but if not, drop me a line here!

Cheers

Pete




Dim AnyTask As Task
Dim Earliest As Date
Dim TitleString As String
Dim PlanName1, PlanName2 As String
Dim PlanHeader As String
Dim MasterPlanName As String
Dim SelectedPlan As Integer
Dim DayCounter As Integer
Dim ColumnNumber As Integer

'========================================================================================
'CORE TOOLS MANAGEMENT PROJECT PLAN
'========================================================================================

Sub Plan_06_CIS()
SelectedPlan = 1
ProduceProjectPlan
End Sub

Sub Plan_07_TDW()
SelectedPlan = 2
ProduceProjectPlan
End Sub

Sub Plan_08_JCPlus()
SelectedPlan = 3
ProduceProjectPlan
End Sub

Sub Plan_09_Elise()
SelectedPlan = 4
ProduceProjectPlan
End Sub

Sub Plan_10_PTP()
SelectedPlan = 5
ProduceProjectPlan
End Sub

Sub ProduceProjectPlan()
FilterProjectPlan
CreateNewProjectPlan
FormatProjectPlan
SaveProjectPlan
End Sub

Sub FilterProjectPlan()
MasterPlanName = ActiveWindow.Caption
FilterOff
OutlineShowAllTasks
Select Case SelectedPlan
Case 1
FilterApply "CopyToNew - CIS"
Case 2
FilterApply "CopyToNew - TDW"
Case 3
FilterApply "CopyToNew - JCPlus"
Case 4
FilterApply "CopyToNew - Elise"
Case Else
FilterApply "CopyToNew - PTP"
End Select
SelectSheet
EditCopy
End Sub

Sub CreateNewProjectPlan()
'=======================================================================================
'Find the earliest atart date in the currently selected block of data

Earliest = "1/1/2049"
For Each AnyTask In ActiveSelection.Tasks
If Not AnyTask Is Nothing Then
If AnyTask.Start < Earliest Then Earliest = AnyTask.Start
End If
Next AnyTask

SendKeys "{enter}"
FileNew SummaryInfo:=True, Template:="", FileNewDialog:=False
ActiveProject.ProjectStart = Earliest
SelectRow Row:=0
EditPaste
End Sub

Sub FormatProjectPlan()

'-----------------------------------------------------------------------------------
'Apply "Table00 - Project" table to show ID, Name, Start, Finish, % Complete
& Resource Names
'Set Calendar for this project to be 09:00-12:00 and 13:00 to 17:30
Monday-Friday (7.5 hrs/37.5 hrs)
'Format summary tasks to Bold Italic Black
'Set 1st 6 columns to repeat at left of each page
'Set Orientation to landscape, print scaling to 60% and paper size to A3
'Set footer to "Page X of Y"
'Remove borders from pages

TableApply Name:="View 02 - Midway (No Resources)"

For DayCounter = 2 To 6
BaseCalendarEditDays Name:="Standard", Weekday:=DayCounter,
Working:=True, _
From1:="09:00", To1:="12:00", From2:="13:00", To2:="17:30",
Default:=False
Next DayCounter

FilePageSetupView RepeatColumns:=8

FilePageSetupPage Portrait:=False, PercentScale:=65, PaperSize:=pjPaperA3

FilePageSetupFooter Text:="Page &[Page] of &[Pages] "

FilePageSetupMargins Borders:=0

Select Case SelectedPlan
Case 1
PlanHeader = "CIS Plan - " & Format(Date, "dd/mmm/yy")
SelectSheet
Font Color:=0
PlanName1 = "F:\Systems Management\06 CIS Plan - " & Format(Date,
"yy-mm-dd") & ".mpp"
PlanName2 = "D:\Pete's Operations\Project Plan\06 CIS Plan - " &
Format(Date, "yy-mm-dd") & ".mpp"
Case 2
PlanHeader = "Tivoli Plan - " & Format(Date, "dd/mmm/yy")
SelectSheet
Font Color:=0
PlanName1 = "F:\Systems Management\07 Tivoli Plan - " & Format(Date,
"yy-mm-dd") & ".mpp"
PlanName2 = "D:\Pete's Operations\Project Plan\07 Tivoli Plan - " &
Format(Date, "yy-mm-dd") & ".mpp"
Case 3
PlanHeader = "JC+ Plan - " & Format(Date, "dd/mmm/yy")
SelectSheet
Font Color:=0
PlanName1 = "F:\Systems Management\08 JC+ Plan - " & Format(Date,
"yy-mm-dd") & ".mpp"
PlanName2 = "D:\Pete's Operations\Project Plan\08 JC+ Plan - " &
Format(Date, "yy-mm-dd") & ".mpp"
Case 4
PlanHeader = "Elise Plan - " & Format(Date, "dd/mmm/yy")
SelectSheet
Font Color:=0
PlanName1 = "F:\Systems Management\09 Elise Plan - " & Format(Date,
"yy-mm-dd") & ".mpp"
PlanName2 = "D:\Pete's Operations\Project Plan\09 Elise Plan - " &
Format(Date, "yy-mm-dd") & ".mpp"
Case Else
PlanHeader = "PTP Plan - " & Format(Date, "dd/mmm/yy")
SelectSheet
Font Color:=0
PlanName1 = "F:\Systems Management\10 PTP Plan - " & Format(Date,
"yy-mm-dd") & ".mpp"
PlanName2 = "D:\Pete's Operations\Project Plan\10 PTP Plan - " &
Format(Date, "yy-mm-dd") & ".mpp"
End Select

'Filter to Level 1 tasks and format to Arial Round MT Bold 12 Black

OutlineShowTasks OutlineNumber:=pjTaskOutlineShowLevel1
Font Name:="Arial Rounded MT Bold"
Font Size:="12"
Font Color:=0

'Select Row 1, format text to white, insert blank row and enter Plan Header
'containing Resource Name and current date date.
'Format Plan Header to appropriate colour, based on team
'Show all tasks and BestFit Columns 1 to 8

SelectTaskField Row:=1, Column:="Name", RowRelative:=False
EditInsert
SetTaskField field:="Name", Value:=PlanHeader, TaskID:=1
Font Name:="Bauhaus 93"
Font Size:="20"
Font Bold:=True
Font Color:=0
SelectTaskField Row:=0, Column:="Start", Width:=4
Font Color:=7

OutlineShowAllTasks
For ColumnNumber = 1 To 7
ColumnBestFit Column:=ColumnNumber
Next

End Sub

Sub SaveProjectPlan()
SendKeys "{Down}{enter}{enter}"
SendKeys "{enter}"
FileSaveAs Name:=PlanName1, FormatID:="MSProject.MPP"
SendKeys "{enter}"
FileSaveAs Name:=PlanName2, FormatID:="MSProject.MPP"
'Return to Systems Management plan & turn filtering off
'FileClose
WindowActivate (MasterPlanName)
FilterOff
End Sub
 
S

SpaceCamel

Thanks Pete,

I will check out your macro, it looks interesting.
I had to find a quick solution. I found that if I saved-as CSV, only the
filtered tasks are saved. Then when I open the CSV as a new Project only the
tasks I filtered for are shown. Will try to find a more elegant solution
later.
 
P

Peter Rooney

Sorry if it was a bit of a sledgehammer to crack a nut, but it DOES work!

Cheers

Pete
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top