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