Chapter 16. Customizing Project

Chapter at a Glance

Customizing Project

In this chapter, you will learn how to:

Copy a customized element, such as a calendar, from one project plan to another by using the Organizer.

Record and play back a macro.

Edit a macro in the Visual Basic for Applications (VBA) Editor.

Customize the Quick Access toolbar and the ribbon.

This chapter describes some of the ways that you can customize Microsoft Project 2010 to suit your own preferences. Project 2010 adopted the ribbon interface, which offers new customization options. Project has other customization features, such as the Organizer and global template, that are unique to it. In addition, Project has customization features, such as recording Microsoft Visual Basic for Applications (VBA) macros, that are similar to what you might be familiar with from other Microsoft Office applications.

Important

Some of the actions that you perform in this chapter can affect your overall settings in Project regardless of the specific project plan you are using. To keep your Project environment unaffected or at the “factory settings” throughout this chapter, we include steps to undo some actions.

Practice Files

Before you can complete the exercises in this chapter, you need to copy the book’s practice files to your computer. A complete list of practice files is provided in Using the Practice Files at the beginning of this book. For each exercise that has a practice file, simply browse to where you saved the book’s practice file folder.

Important

If you are running Project Professional, you may need to make a one-time setting change. This helps ensure that the practice files you work with in this chapter do not affect your Project Server data. For more information, see Appendix C.

Sharing Custom Elements Between Project Plans

Project uses a feature called the global template, named Global.mpt, to provide the default views, tables, and other elements that you see in Project. The very first time you display a view, table, or similar element in a project plan, it is copied automatically from the global template to that project plan. Thereafter, the element resides in the project plan. Any subsequent customization of that element in the project plan (for example, changing the fields displayed in a table) applies to only that one project plan and does not affect the global template. The global template is installed as part of Project and you normally don’t work with it directly.

Initially, the specific definitions of all views, tables, and other elements listed here are contained in the global template. For example, the fact that the default usage table contains one set of fields and not others is determined by the global template. The list of elements provided by the global template includes the following:

  • Views

  • Reports

  • Tables

  • Filters

  • Calendars

  • Groups

In addition, you can copy modules (VBA macros), maps, and custom fields to the global template or between project plans.

When you customize an element like a view, the customized element remains in the project plan in which it was customized. With views and tables, you have the option of updating the version of that element in the global template with your customized view or table. If you create a new element, however, such as a new view, that new element is copied to the global template and thereafter becomes available in all other project plans you may work with.

One exception, however, is calendars. When you create a custom calendar, it remains just in the project plan in which it was created. A customized standard calendar that meets your needs in one project plan could redefine working times in other project plans in ways that you do not intend. For this reason, Project has a feature that allows you to share custom calendars (and other elements) between project plans in a controlled way. That feature is the Organizer.

The complete list of elements that you can copy between project plans with the Organizer was listed previously and is indicated by the names of the tabs in the Organizer dialog box, which you will see shortly.

You could use Project extensively and never need to touch the global template. However, when you do work with the global template, you normally do so through the Organizer. Some actions that you can accomplish relating to the global template include the following:

  • Create a customized element, such as a custom calendar, and make it available in all project plans that you work with by copying the custom calendar into the global template.

  • Replace a customized element, such as a view or table, in a project plan by copying the original, unmodified element from the global template to the project plan in which you’ve customized the same element.

  • Copy one customized element, such as a custom calendar, from one project plan to another.

The settings in the global template apply to all project plans that you work with in Project. Because we don’t want to alter the global template that you use, in this exercise, we’ll focus on copying customized elements between two project plans. Keep in mind, though, that the general process of using the Organizer shown here is the same whether you are working with the global template and a project plan or two project plans.

Important

In the Organizer, when you attempt to copy a customized view, table, or other element from a project plan to the global template, Project alerts you as to whether you will overwrite that element with the same name in the global template. If you choose to overwrite it, that customized element (such as a customized view) will be available in all new project plans and any other project plans that do not already contain that element. If you choose to rename the customized element, it becomes available in all project plans but does not affect the existing elements already stored in the global template. It’s generally a good idea to give your customized elements unique names, such as Custom Gantt Chart, so that you can keep the original element intact.

In this exercise, you will copy a custom calendar from one project plan to another.

Set Up

Set Up

Start Project if it’s not already running.

You need multiple project plans located in your Chapter16 practice file folder to complete this exercise. Begin by opening the Customizing A_Start project plan, and then follow these steps.

  1. On the File tab, click Save As.

    The Save As dialog box appears.

  2. In the File name box, type Customizing A, and then click Save.

  3. Next, open Customizing B_Start and save it as Customizing B.

  4. On the View tab, in the Window group, click Switch Windows and then click 1 Customizing A.

    Set Up

    Switch Windows

    The Customizing A project plan contains a custom calendar named Monday-Wednesday that you created in Chapter 7.

  5. Scroll the Gantt Chart view vertically until task 44, Send to color house, is visible, and then point the mouse pointer at the calendar icon in the Indicators column.

    Set Up

    This task uses the custom calendar, so it can occur only on a Monday, Tuesday, or Wednesday. You’d like to use this calendar in the Customizing B project plan.

  6. On the File Tab, click Info, and then click Organizer.

    The Organizer dialog box appears.

  7. Click several of the tabs in the dialog box to get a look at the types of elements you can manage with the Organizer, and then click the Calendars tab.

    Set Up

    As you can see, every tab of the Organizer dialog box has a similar structure: elements in the global template appear on the left side of the dialog box, and the elements that have been used in the active project plan at any time (for example, views displayed) appear on the right.

    Selecting an element on the left side of the dialog box and then clicking the Copy button will copy that element to the project plan listed on the right. Conversely, selecting an element on the right side of the dialog box and then clicking the Copy button will copy that element to the file listed on the left (the global template by default).

  8. From the Calendars available in drop-down list on the left side of the Organizer dialog box, select Customizing B.

    This project plan appears in the list because it is open in Project.

    Set Up

    As you can see, the Customizing B plan (on the left) does not have the Monday-Wednesday custom calendar, and the Customizing A plan (on the right) does.

  9. In the list of calendars on the right side of the dialog box, click Monday-Wednesday.

    Tip

    Notice that the two arrow symbols (>>) in the Copy button switch direction (<<) when you select an element on the right side of the dialog box.

  10. Click Copy.

    Project copies the custom calendar from the Customizing A plan to the Customizing B plan.

    Tip
  11. Click Close to close the Organizer dialog box.

    Tip

    In this exercise, you used the Organizer to copy a custom calendar from one project plan to another. If you want to make a custom calendar available in all project plans, use the Organizer to copy it into the global template instead.

    To conclude this exercise, you apply the custom calendar to a task in the Custom B plan.

  12. On the View tab, in the Window group, click Switch Windows, and then click 2 Customizing B.

    Project switches to the Customizing B plan, which is the plan to which you just copied the custom calendar.

  13. Select the name of task 19, Send to color house.

  14. On the Task tab, in the Editing group, click Scroll to Task.

    Tip

    Note that this 1-day task is currently scheduled to occur on a Thursday.

    Tip
  15. On the Task tab, in the Properties group, click Information.

    Tip

    The Task Information dialog box appears.

  16. Click the Advanced tab.

    As you can see in the Calendar box, the default for all tasks is “None.”

  17. In the Calendar box, select Monday-Wednesday from the list of available base calendars, and then click OK to close the dialog box.

    Project applies the Monday-Wednesday calendar to task 19 and reschedules the task to start on Monday, the next working day on which the task can occur. A calendar icon appears in the Indicators column, reminding you that this task has a task calendar applied to it. Note that the Monday-Wednesday calendar was not available in this project plan until you copied it via the Organizer.

  18. Point to the calendar icon.

    Tip

    As you customize views, tables, and other elements, you may find the Organizer to be a useful feature for managing your customized elements and the built-in elements in Project.

Clean Up

Clean Up

Close the Customizing B file. The Customizing A file should remain open.

Recording Macros

Many activities that you perform in Project can be repetitive. To save time, you can record a macro that captures keystrokes and mouse actions for later playback. The macro is recorded in Microsoft Visual Basic for Applications (VBA), the built-in macro programming language of the Microsoft Office system. You can do sophisticated things with VBA, but you can record and play back simple macros without ever directly seeing or working with VBA code.

The macros that you create are stored in the global template by default, so they are available to you whenever Project is running. The project plan for which you originally created the macro need not be open to run the macro in other project plans. For example, you can use the Organizer to copy the VBA module (which contains the macro) from the global template to another project plan to give it to a friend.

Creating a graphic image snapshot of a view is a great way to share project details with others. However, it’s likely that the details you initially capture will become obsolete quickly as the project plan is updated. Capturing updated snapshots can be a repetitive task that is ideal for automation through a macro. When this task is automated, you can quickly generate a new GIF image snapshot of a project plan and save the GIF image to a file. From there, you could attach the GIF image to an e-mail message, publish it to a Web site, insert it into a document, or share it in other ways.

In this exercise, you record and run a macro.

  1. On the View tab, in the Macros group, click the down arrow below the Macros button, and then click Record Macro.

    Recording Macros

    The Record Macro dialog box appears.

  2. In the Macro name box, type Capture_GIF_Image.

    Tip

    Macro names must begin with a letter and cannot contain spaces. To improve the readability of your macro names, you can use an underscore (_) in place of a space. For example, rather than naming a macro CaptureGIFImage, you can name it Capture_GIF_Image.

    For this macro, we will not use a shortcut key. When recording other macros, note that you cannot use a Ctrl+ combination that is already reserved by Project, so combinations like Ctrl+F (the keyboard shortcut for Find) and Ctrl+G (Go To) are unavailable. When you click OK to close the dialog box, Project alerts you whether you need to choose a different key combination.

  3. In the Store macro in box, click This Project to store the macro in the active project plan.

    When a macro is stored in a project plan, the macro can be used by any project plan when the project plan that contains the macro is open. The default option, Global File, refers to the global template. When a macro is stored in the global template, the macro can be used by any project at any time because the global template is open whenever Project is running. In this exercise, since we don’t want to customize your global template, you’ll store the macro in the active project plan.

  4. In the Description box, select the current text and replace it by typing Saves a GIF image of the Gantt Chart view.

    Tip

    The description is useful to help identify the actions that the macro will perform.

  5. Click OK.

    Project begins recording the new macro. Project does not literally record and play back every mouse movement and passing second; it records only the results of the keystrokes and mouse actions that you make. Do not feel that you have to rush to complete the recording of the macro.

  6. On the View tab, in the Task Views group, click the down arrow below the Gantt Chart button, and then click Gantt Chart.

    Tip

    Even though the project plan is already showing the Gantt Chart view, including this step in the macro thereby records the action so that, if the project plan were initially in a different view, the macro would switch to the Gantt Chart view.

  7. On the View tab, in the Zoom group, in the Timescale box, click Thirds of Months.

    Project adjusts the timescale to display more of the project.

    Tip
  8. Click the Task Name column heading.

  9. On the Task tab, in the Clipboard group, click the arrow next to Copy, and then click Copy Picture.

    Tip

    The Copy Picture dialog box appears.

  10. Under Render image, click To GIF image file, and then click Browse.

  11. In the Browse dialog box, navigate to the Chapter16 folder, and then click OK.

  12. Under Copy, click Selected Rows.

  13. Under Timescale, in the From box, type or select 4/2/12, and in the To box, type or select 12/7/12.

    This date range matches the project plan’s current start and finish date. You can see these dates for task 0, the project summary task.

    Tip
  14. Click OK to close the Copy Picture dialog box.

    Project saves the GIF image.

  15. On the View tab, in the Zoom group, click Zoom and then click Zoom.

    Tip
  16. In the Zoom dialog box, click Reset, and then click OK.

    Now you are ready to stop recording.

  17. On the View tab, in the Macros group, click the down arrow below the Macros button, and then click Stop Recording.

    Next, you will run the macro to see it play back.

  18. On the View tab, in the Macros group, click Macros.

    The Macros dialog box appears.

    Tip
  19. In the Macro name box, click Customizing A.mpp!Capture_GIF_Image, and then click Run.

    The macro begins running, but pauses as soon as Project generates a confirmation message to replace the existing GIF image file (the one that you just created while recording the macro).

    Important

    Your security level setting in Project affects Project’s ability to run macros that you record or receive from others. You may not have set the security level directly, but it may have been set when you installed Project or by a system policy within your organization.

  20. Click Overwrite to overwrite the previously created GIF image file.

    The macro resaves the GIF image. Next, you’ll see the results of the macro’s actions.

  21. In Windows Explorer, navigate to the Chapter16 folder and double-click the Customizing A GIF image file to open it in your image editor or viewer application.

    The GIF image appears in your image viewer application. In the following illustration, we are displaying the GIF image in a Web browser. Your screen should look similar to this.

    Important
  22. Close your image viewing application, and then switch back to the Customizing A project plan in Project.

This macro would be very useful if the project manager at Lucerne Publishing needed to recapture the project plan snapshot frequently. For example, the project manager could recapture it at regular intervals during the planning stage (when the details are being developed) and then again during the execution stage (when the effects of actual progress change the remaining scheduled work).

Editing Macros

As handy as the Capture_GIF_Image macro is to use, it can be improved. Remember that when you ran it in the previous exercise, you had to confirm that Project should overwrite the existing GIF image. Because the intent of the macro is to capture the most current information, you would always want to overwrite the older information. You can change the macro code directly to accomplish this. The macro code resides in a VBA module, and you work with the code in the Visual Basic for Applications environment, commonly called the VBA Editor.

Tip

The VBA language and VBA Editor are standard in many of the programs in the Microsoft Office system (including Project). Although the specific details of each program differ, the general way in which you use VBA in each is the same. VBA automation is a powerful tool you can master, and that knowledge can be used in many Microsoft programs.

In this exercise, you work in the VBA Editor to fine-tune and enhance the macro that you recorded in the previous exercise and then run it.

  1. On the View tab, in the Macros group, click Macros.

    Tip
  2. Under Macro name, click Customizing A.mpp!Capture_GIF_Image, and then click Edit.

    Project loads the module that contains the macro in the VBA Editor.

    Tip

    A full explanation of the VBA language is beyond the scope of this book, but we can walk you through some steps to change the behavior of the previously recorded macro. You might also recognize some of the actions that you recorded earlier by the names used in the VBA code.

  3. Click at the beginning of the line ViewApplyEx Name:="&Gantt Chart”, ApplyTo:=0 and press the Enter key.

  4. Click in the new line you just created, press the Tab key, and type Application.Alerts False.

    This line of code will suppress the prompt that you received when running the macro and accept the default option of replacing the existing GIF image file with the same name.

    Tip

    Tip

    Note that as you were typing, selection boxes and ScreenTips might have appeared. The VBA Editor uses such tools and feedback to help you enter text in a module correctly.

  5. In the line that begins with EditCopyPicture, select the date and time “4/2/12 8:00 AM” (including the quotation marks) that follows FromDate:=, and type ActiveProject.ProjectStart.

    This VBA code describes the project start date of the active project.

    Tip

    This causes the macro to get the current start date of the active project for the GIF image that the macro creates.

  6. In the same line, select the date and time “12/7/12 5:00 PM” (including the quotation marks) that follows ToDate:=, and type ActiveProject.ProjectFinish.

    Tip

    This causes the macro to get the current finish date of the active project for the GIF image that the macro creates. Now, if the project plan’s start or finish date changes, the date range used when copying the GIF image will change as well.

    Next, you’ll add new macro capabilities while in the VBA Editor.

  7. Click at the beginning of the line SelectTaskColumn, and press Enter.

  8. Click in the new line you just created, press Tab, and type FilterApply Name:="Incomplete Tasks”.

    This line of code will apply the Incomplete Tasks filter to the current view.

  9. Click at the beginning of the line ZoomTimescale Reset:=True, and press Enter.

  10. Click in the new line you just created, press Tab, and type FilterClear.

    This line of code will remove the Incomplete Tasks filter from the current view.

    Tip
  11. On the File menu in the VBA Editor, click Close and Return to Microsoft Project.

    The VBA Editor closes, and you return to the project plan.

    You could run the updated macro now, but first, you’ll record some progress on tasks.

  12. Click the name of task 31, Proofread and index.

  13. On the Task tab, in the Schedule group, click the down arrow to the right of the Mark on Track button and then click Update Tasks.

    Tip

    The Update Tasks dialog box appears.

  14. In the Actual dur field, type 16d, and then click OK.

    Next, you’ll record partial progress on another task.

  15. Click the name of task 32, Incorporate 1st Pages review.

  16. On the Task tab, in the Schedule group, click the down arrow to the right of the Mark on Track button and then click Update Tasks.

  17. In the Actual dur field, type 5d, and then click OK.

    Tip

    Now you are ready to rerun the macro.

  18. On the View tab, in the Macros group, click Macros.

  19. Under Macro name, click Customizing A.mpp!Capture_GIF_Image, and then click Run.

    The macro runs, and this time, you are not prompted to overwrite the previously saved file. To verify that the macro ran correctly, you’ll view the updated GIF image in your image application.

  20. In Windows Explorer, navigate to the Chapter16 folder, and double-click the Customizing A GIF image file to open it in your image editor or viewer application.

    The GIF image appears in your image application.

  21. If you are viewing the image in Windows Internet Explorer, depending on your screen resolution you may be able to click the GIF image to magnify it.

    Tip

    The updated screenshot includes the updated project finish date and displays only incomplete tasks because the macro applied the Incomplete Tasks filter (note that task 31, which is now completed, does not appear). Now you can run the macro as frequently as needed to capture the most up-to-date information.

  22. Close your image viewing application, and then switch back to the Customizing A project plan in Project.

Here are some additional tips for working with VBA macros in Project.

  • VBA is a rich and well-documented programming language. If you would like to take a closer look at VBA in Project, try this: On the View tab, in the Macros group, click the down arrow below the Macros button, and then click Visual Basic. In the “Microsoft Visual Basic for Applications” window, on the Help menu, click “Microsoft Visual Basic for Applications Help.”

  • While working in a module, you can get help on specific items such as objects, properties, and methods. Click a word, and then press the F1 key.

  • To close the VBA Editor and return to Project, on the File menu, click Close and Return to Microsoft Project.

Customizing the Ribbon and Quick Access Toolbar

As with other Office applications, you have several choices concerning how to work with Project. Some of the many customization settings include the following:

  • Add frequently used commands to the Quick Access toolbar.

  • Customize an existing tab on the ribbon or create a new tab that includes any commands that you want.

In this exercise, you add a command to the Quick Access Toolbar and create a custom ribbon.

  1. On the File tab, click Options.

    The Project Options dialog box appears.

  2. In the Project Options dialog box, click the Quick Access Toolbar tab.

  3. On the left side of the dialog box, in the Choose commands from box, click Commands Not in the Ribbon.

    Project displays the list of commands that you otherwise cannot access from the ribbon. Take a moment to look through this list for commands that you would like quick access to.

  4. In the list of commands, click Go To, and then click Add.

    Project adds the Go To command to the right side of the dialog box.

    Customizing the Ribbon and Quick Access Toolbar

    The Go To command is a handy way to navigate to a specific task ID and scroll the timescale in the Gantt Chart view, all in one action.

  5. Click OK to close the Project Options dialog box.

    Project adds the Go To command to the Quick Access toolbar.

    Customizing the Ribbon and Quick Access Toolbar

    Now try out the Go To command by doing the following steps:

  6. On the Quick Access toolbar, click Go To.

    Customizing the Ribbon and Quick Access Toolbar

    Go To

  7. In the Go To dialog box, type 43 in the ID box and then click OK.

    Tip

    In the Go To dialog box, you can also enter a date value in the Date field to scroll the Gantt Chart’s timescale to a specific date.

    Project jumps to task 43 and scrolls the chart portion of the Gantt Chart view to display its Gantt bar.

    Tip

    If you’d like to remove the command from the Quick Access toolbar, complete the following steps.

  8. On the Quick Access Toolbar, right-click the Go To button and in the shortcut menu that appears, click Remove from Quick Access Toolbar.

    To conclude this exercise, you will create a custom tab and add a command that runs the Capture_GIF_Image custom macro to it.

  9. On the File tab, click Options.

  10. In the Project Options dialog box, click the Customize Ribbon tab.

    Project displays options for customizing the ribbon.

    Tip

    Here, you can get access to the commands and features supported by Project.

  11. On the right side of the dialog box, under Main Tabs, click the name View and then click New Tab.

    Project creates a new tab and group below (which on the Ribbon will be to the right of) the View tab.

    Tip
  12. On the right side of the dialog box, under Main Tabs, click the name New Tab (Custom) and then click Rename.

    The Rename dialog box appears.

  13. In the Display name field, type Custom and then click OK.

  14. Click the New Group (Custom) item, and then click Rename.

    The Rename dialog box appears.

  15. In the Display name field, type My Commands and then click OK.

    Now you are ready to add the custom macro to the new ribbon.

  16. On the left side of the dialog box, In the Choose commands from box, click Macros.

    The name of the custom macro appears.

  17. Select the name of the Customizing A.mpp!Capture_GIF_Image macro, and then click Add.

    Project adds the macro item to your custom group.

    Tip

    Next, you will rename the macro command and assign it an icon.

  18. On the right side of the dialog box, select the name of the Customizing A.mpp!Capture_GIF_Image macro, and then click Rename.

  19. In the Display name field, type Copy GIF, and in the Symbol box, select the picture image (sixth from the left in the second row).

    Tip
  20. Click OK to close the Rename dialog box, and then click OK to close the Project Options dialog box.

    Project adds your custom tab to the interface.

  21. Click the Custom tab.

    Tip
  22. On the Custom tab, in the My Commands group, click Copy GIF.

    Project runs the macro. If you wish, navigate to the Chapter16 folder to view the GIF image.

    Finally, you will remove the custom ribbon to undo this customization.

  23. Right-click the Custom tab, and in the shortcut menu that appears, click Customize the Ribbon.

  24. On the right side of the Project Options dialog box, right-click Custom (Custom), and in the shortcut menu that appears, click Remove.

    Tip

    You can also click the Reset button to undo all ribbon and Quick Access toolbar customizations that may have been made to your copy of Project.

  25. Click OK to close the Project Options dialog box.

    Project has removed the custom tab.

    Tip

Clean Up

Clean Up

Close the Customizing A file.

Key Points

  • In Project, elements such as custom calendars are managed through the global template via the Organizer.

  • Project, like many other programs in the Microsoft Office system, uses the Visual Basic for Applications (VBA) macro programming language. Among other things, macros enable you to automate repetitive tasks.

  • If you want to work directly with VBA code, you do so in the VBA Editor, which is included in Project as well as other Office applications.

  • You can customize the Quick Access toolbar and ribbons in Project to include the commands and features that interest you the most.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset