MS Project does not have the ability to recalculate resource baselined work summaries. This code does it.
Note: All the code in this project is designed for Baseline1 Work. If you use a different baseline, you will need to adjust the code accordingly.
When you save work as a baseline in MS Project, the following data is saved:
- Time-phased data for assignments (saved as the baseline).
- Current summaries for assignments over the entire time period.
- Time-phased data for the entire resource.
- Summary for the entire assignment (for all time).
- Total resource baseline work (summed over all time).
However, when you later replan and save tasks that contain these assignments, MS Project updates only:
- Task-related data, and
- Time-phased data of the assignment in the baseline.
Not updated:
- Vertical summaries (time-phased resource total baselined work)
- Horizontal summaries (sum of all baselined work per assignment)
- Total resource baseline work
This script goes through all resource assignments and all project days to recalculate missing summaries. It also deletes any orphaned assignments (from deleted tasks or resources) since they are invalid.
- Click on the File tab.
- Select Options.
- In the Project Options window, choose Customize Ribbon.
- In the right pane, check the box for Developer.
- Click OK.
You can open the Macro Editor (Visual Basic Editor) using one of these methods:
- Keyboard Shortcut: Press
Alt + F11on your keyboard. - Via Ribbon: Click on the Developer tab and then click Visual Basic.
- In the Visual Basic Editor (VBE), go to the menu and click Insert.
- Select Module.
A new module window will open where you can add your code.
- Make sure the new module is active.
- Press
Ctrl + V(or right-click and select Paste) to insert your code from the clipboard into the module.
- In the VBE, click File > Save [YourProjectName] to save your changes.
- Alternatively, return to Microsoft Project and save the project file.
There are several ways to run your macro:
Option A: Run from the Visual Basic Editor
- With your code window open, press
F5to run the macro. - Alternatively, click Run > Run Sub/UserForm from the menu bar.
Option B: Run from Microsoft Project via the Developer Tab
- In Microsoft Project, click on the Developer tab.
- Click on Macros.
- In the Macro dialog box, select the macro you want to run.
- Click Run.
Option C: Run the Macro Using Alt + F8
- In Microsoft Project, press
Alt + F8to open the Macros dialog box. - Select the macro you want to run.
- Click Run.
- This script is designed specifically for Baseline1 Work.
- It recalculates missing summaries for all resource assignments and project days.
- If it detects orphaned assignments (from deleted tasks or resources), it will delete them since they are invalid.
- If you experience issues, verify your macro security settings under File > Options > Trust Center > Trust Center Settings > Macro Settings.
Feel free to modify or extend this guide to suit your needs!