
Configuring Automatic Macro Execution in Microsoft Project
1. Overview
🚀 For IT Administrators and power users, automating the Microsoft Project environment can significantly streamline workflows and ensure consistent project settings across an organization. By utilizing a specific naming convention for macros combined with modified application shortcuts, you can trigger custom VBA (Visual Basic for Applications) code to execute immediately upon the launch of Microsoft Project. This process involves creating a dedicated project file—often referred to as a “startup file”—that contains an Auto_Open macro. When this file is passed as a command-line argument to the Project executable (WINPROJ.EXE), the macro initializes automatically, allowing for environment configuration, custom reporting, or integration with other enterprise tools right at startup.
2. Key Technical Details
⚙️ Creating the Startup Macro (Project 2013, 2016, 2019, and Project Online Desktop Client):
- Initialize a new project file. While this guide refers to it as
STARTUP.MPP, any valid filename is acceptable. - Navigate to the View menu, select Macros, and then View Macros.
- Type the specific name
Auto_Openinto the Macro Name field and select Create to launch the Visual Basic for Applications (VBA) editor. - Insert the desired functional code within the
Auto_Openprocedure. - Save the project file (e.g.,
STARTUP.MPP) and exit the VBA editor and Microsoft Project.
📜 Legacy Support (Older Versions):
- For versions prior to Project 2010, the macro is created via Tools > Macros > New.
- Under Options, ensure that Store Macro In is set to Current Project File.
- Name the macro
Auto_Openand proceed with code entry as described above.
🔗 Modifying the Application Shortcut:
- Locate or create a desktop shortcut for the Microsoft Project executable,
WINPROJ.EXE. - Right-click the shortcut and open Properties.
- In the Target field, append the full file path of your startup project to the executable path. For example:
c:\winproj\winproj.exe c:\data\Startup.mpp - Click OK to save the changes.
🛠️ Advanced Automation Logic:
- Running Global Macros: The
Auto_Openmacro can serve as a wrapper to trigger macros stored in theGLOBAL.MPT. For instance, if you have a macro named “MyStartup,” you can call it using:
Macro "MyStartup" - Automatic Project Creation: Because launching with a specific file prevents Project from creating the default “Project1” blank file, you can force a new project to open by adding the
FileNewmethod to your code. - Self-Closing Logic: To close the
STARTUP.MPPfile immediately after the macro finishes so the user isn’t prompted to save it, use the following snippet:Projects("Startup.mpp").Activate FileClose save:=pjDoNotSave
3. Impact
🛡️ Security and Control: Upon launching the shortcut, users will be prompted to enable macros. The Auto_Open macro will only execute if the user selects “Yes” or if the organization’s macro security policies (set via Group Policy or Trust Center) allow for it. This provides a layer of security against unauthorized code execution.
⌨️ Administrative Bypass: In scenarios where an administrator needs to troubleshoot the application without the macro running, the automation can be bypassed. Simply press and hold the SHIFT key while starting Microsoft Project to suppress the Auto_Open execution.
📅 Deployment Efficiency: By deploying a standardized STARTUP.MPP and a modified shortcut to workstations, IT Admins can ensure that all project managers are working within a pre-configured environment, complete with custom ribbons, global settings, or mandatory data connections.
Official Source: Read the full article on Microsoft.com
