Testing the code

Now you can run the modified code to test the changes that you made. Use the following steps to do so:

1. Click the Run Sub/UserForm button in the toolbar at the top of the screen, as shown in Figure 25-6.

Run Sub/Userform button

Run Sub/Userform button

Figure 25-6: Click the Run Sub/UserForm button to run the VBA sub procedure.

2. The Microsoft Project dialog box opens, as shown in Figure 25-7. At the prompt to enter the resource name, type Project Manager and click OK.

Figure 25-7: Select a resource whose tasks you want to view.

The filter is then applied so that you can only view the tasks in the project that are late, on the critical path, and assigned to the resource Project Manager (see Figure 25-8).

Figure 25-8: After adding the filter, you can view tasks that are on the critical path for the specified resource.

I'll review the changes that you made to the code so that you can understand the purpose of each change. The line that begins with Dim declares a variable that is used to store the resource name that the user types into the dialog box. The variable that you created is known as a string variable, which is designed to store text.

The line strResourceName = InputBox("Please enter the resource name:") displays a dialog box, known as an InputBox, that prompts the user to type in the resource name, and the name that the user enters is stored in the variable strResourceName.

On the last line, which begins with FilterEdit, you substituted the text Analyst with the variable strResourceName. The name that the user entered in the InputBox is used as the filter value for the Resource Names field.

To run your macro without having to choose ToolsoMacrooMacros, you can assign your macro to a toolbar button or add it to a custom menu.

See Chapter 24 for detailed instructions on assigning macros to toolbars or menus.

Project Management Made Easy

Project Management Made Easy

What you need to know about… Project Management Made Easy! Project management consists of more than just a large building project and can encompass small projects as well. No matter what the size of your project, you need to have some sort of project management. How you manage your project has everything to do with its outcome.

Get My Free Ebook

Post a comment