Loading...
Quick Links

There’s No Place Like Home: How to Create a Home View Macro

Autopilot imageHave you ever opened one or more Microsoft project files and had a blank screen due to a null-filter or a view that was unfamiliar or out of sorts? What happened to your project?! Why are tasks out of order or missing? Do your consolidated schedules have different views as you toggle from one to another?

Well, there are several possible reasons why this is happening — and one probable solution for addressing this dilemma. If you’re performing various analyses, filtering, sorting or grouping either in your individual schedule file or Master consolidated schedule and forget to undo one or more of those actions and save, you’ll end up with a mess. What you or other users will see is a a jumble of unrecognizable information or a blank screen due to a null-filter! So what to do?

If you’re working in a dozen or more schedules simultaneously in a consolidated schedule, as I do, you can easily create a Home View Macro. A Home View is your selected view that you want all schedules to show when opened by stakeholders. My Home view is a simple Gantt chart with no bar styles.

As an aside, using Microsoft’s default bar definitions with many schedules in a consolidated view causes a long wait-time to refresh after every move, especially if your files are located on a file server or working off Microsoft Project Server. Deleting all bar definitions and leaving the bar style window empty will speed up your computer. I’ve created a separate view titled, “Gantt chart – Table Only,” to keep it separate from Microsoft’s default Gantt chart.

Here’s the macro that you can copy and paste into a new macro window, and you can revise with credits. It works well with the 14 subprojects I use it with. Enjoy!

Sub Home()
‘ This Macro resets the active view in all
‘ consolidated files to 00 – Gantt Table Only Shows All tasks,
‘ calculates and saves files.
‘ This assumes all schedules are maintained by
‘ one scheduler. If not, make sure other
‘ schedule owners are OK with saving their schedule.
‘ Macro Originally Recorded 5/4/10 by Angelo Arcoleo
‘ (angeloarcoleo@gmail.com) and enhanced by
‘ Jim Aksel (jeaksel@yahoo.com)

‘Caution: Potential errors if file type (2003/2007)
‘ not equal to version of Project running.

Dim j As Integer

For j = 1 To Application.Projects.Count ‘The number of open projects

Dim mProj As Project

Set mProj = Application.Projects.Item(j) ‘Grab a project

mProj.Activate ‘Make this the “Active Project”

‘ In order to apply this view, the view already has to be in the
‘ project file or in the global.mpt. You can replace
‘ with a view of your choice.

ViewApply Name:=”00 – Gantt Table Only” ‘Apply a view

OutlineShowAllTasks

CalculateAll

FilterApply Name:=”Incomplete Tasks”

FileSave

Next j ‘Go to the next project in line

mProj = Nothing ‘returns memory

End Sub

Share This Post
2 Comments
  1. Small comment on the code.
    Its not a good idea to Dim a variable inside a loop. Either you end up losing a lot of memory or you just slow the macro down a lot. Simpler code would be:
    Sub Home()
    Dim mProj As Project
    For Each mProj In Application.Projects
    mProj.Activate ‘Make this the “Active Project”

    ‘ In order to apply this view, the view already has to be in the
    ‘ project file or in the global.mpt. You can replace
    ‘ with a view of your choice.
    ViewApply Name:=”00 – Gantt Table Only” ‘Apply a view
    OutlineShowAllTasks
    CalculateAll
    FilterApply Name:=”Incomplete Tasks”
    FileSave
    Next mProj ‘Go to the next project in line

    Set mProj = Nothing ‘returns memory
    End Sub

    I love simple!

    Reply
  2. Adding to the code you could move the timescale to today’s date to save users a little more time.
    For project files shared by several people I’ve used the following (this was in a refinery upgrade where 5 planners need access to 6 different schedules).
    1) Create a View for each planner, EG Gantt Chart – Rod
    This means each planner has their own view they can format as they like and not suffer the view left by the previous user!
    2) Use Application.Username to read the name of the active user and then apply the relevant Gantt Chart.

    This worked a treat.

    In large projects there are many milestones and I’ve found that they often fail to get updated to 100%. So I add code to the before_save event that sets any milestone with predecessors that are all 100% complete to be 100%.

    Then there are macros that loop thru all tasks and warn of tasks with missing values in custom fields, especially those that are important for automated reporting.

    Happy programming!

    Reply

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

Please complete this equation so we know you’re not a robot. *

− 2 = 5

Thanks for submitting your comment!
You must be logged in to comment.