Article ID: 128622 - View products that this article applies to.
This article was previously published under Q128622
Expand all | Collapse all

Summary

To make a macro run automatically whenever the Microsoft Project icon is used to start Microsoft Project, edit the command line for the icon's properties so that a project containing an Auto_Open macro is opened automatically at startup. 

More information

The following steps will cause an Auto_Open macro to be executed when you start Microsoft Project by double-clicking the Microsoft Project shortcut icon or by double-clicking the Microsoft Project file which contains the Auto_Open macro. 

In Project 2013 and 2010 use the following steps:

  1. Create a new project. Note: for this example, the project is named as STARTUP.MPP, but you can use any valid filename.
  2. From the View menu, choose Macros, and click View Macros.
  3. Begin to type a new name for the macro called "Auto_Open" and click Create. Microsoft Visual Basic For Applications window will launch.
  4. In the VBA editor, enter the code that you want to be run each time Microsoft Project is started. 
  5. From the editor's File menu, choose Save STARTUP.MPP, from the File menu click Close and Return to Microsoft Project.
  6. Save the plan and Close Microsoft Project. The next time you open this plan the Auto_Open macro will run if you answer Yes to enable macros.

    NOTE: The Auto_Open macro can also run other macros. For example, if there is only one macro in GLOBAL.MPT called "MyStartup," and if it takes no arguments, then Auto_Open can run it using: Macro "MyStartup"
  7. Create a shortcut on your desktop for Microsoft Project. The executable is called WINPROJ.EXE.
  8. Right click the shortcut and click Properties. In Target, append the path to your saved plan STARTUP.MPP. For example: c:\winproj\winproj.exe c:\data\Startup.mpp. click OK.
NOTE: The Auto_Open macro can also run other macros. For example, if there is only one macro in GLOBAL.MPT called "MyStartup," and if it takes no arguments, then Auto_Open can run it using: Macro "MyStartup".


Follow these steps for earlier versions of Microsoft Project
  1. Create a new project. NOTE: For this example, the project is named as STARTUP.MPP, but you can use any valid filename.
  2. From the Tools menu, choose Macros, and choose the New button. Choose Options, and under Store Macro In, select Current Project File.
  3. In the Macro Name box, type Auto_Open and Choose OK.
  4.  Follow steps 4 through 8 above.


If you do not want the Auto_Open macro in STARTUP.MPP to be run, press and hold the SHIFT key when you start Microsoft Project.

Microsoft Project does not automatically create a blank Project1 when the icon is set up to automatically open a project. To create a new project, you can use the FileNew method in the Auto_Open macro in STARTUP.MPP.

If want to close STARTUP.MPP after you start Microsoft Project, add code to the Auto_Open macro to close it. For example, the following lines activate STARTUP.MPP and then close it without saving changes:
   Projects("Startup.mpp").Activate
   FileClose save:=pjDoNotSave
				
For additional information, please see the following article in the Microsoft Knowledge Base:
126105 "Auto_Open and Auto_Close Macros"

Properties

Article ID: 128622 - Last Review: April 26, 2013 - Revision: 6.0
Applies to
  • Microsoft Project 2013 Professional
  • Microsoft Project 2013 Standard
  • Microsoft Project Professional 2010
  • Microsoft Project Standard 2010
  • Microsoft Office Project Professional 2007
  • Microsoft Office Project Standard 2007
  • Microsoft Office Project Professional 2003
  • Microsoft Office Project Standard 2003
  • Microsoft Project 2002 Professional Edition
  • Microsoft Project 2002 Standard Edition
  • Microsoft Project 98 Standard Edition
  • Microsoft Project 4.1 Standard Edition
  • Microsoft Project 4.0 Standard Edition
  • Microsoft Project 4.0 for Macintosh
Keywords: 
kbcode kbhowto kbprogramming KB128622

Give Feedback

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com