TIP: How to Automatically Close Blank Project1 upon Opening MS Project

© 2011 Brice Center (first posted 10/20/11 ► last updated 11/11/11)

Overview

Problem

Every time you open Microsoft Project, it creates a new blank project called Project1.  If you are working in a Project Server environment, you will usually just ignore Project1, and then simply open an existing project from the server to work on.  When you later close MS Project, it prompts you to either save Project1 or Discard it, even if you made absolutely no changes to it.  ▼

It ends up being an irritating nuisance for 2 reasons:

1. It requires an extra 2 mouse clicks each time to close MS Project, and demands your attention to read and verify that you are discarding Project1, and not something more important.

2. It builds a habit of selecting "Discard Changes," which might cause you to accidentally click "Discard Changes" on another project that you DID intend to save if you are rushing when you close MS Project.  I have done this and lost work because of it.  Anything that causes me to lose work, must be fixed.


Solution Overview

Action 1: Create a project file with an Auto_Open macro that shuts that same project down immediately after opening MS Project. 
Action 2: Place your file in a safe location, and create a new program shortcut that accesses that file when opening MS Project.




Solution Details

This tutorial was done in MS Project Professional 2007.  The steps should be the same (or simliar) in MS Project 2010 and 2003.

Action 1: Create Macro Project

Create a Project File with an Auto_Open macro that shuts that same project down immediately after opening MS Project.


1. Create a new project, then save it (the filename you choose will be used in the macro later in Step 6 below).  NOTE: For this example, the project is named as STARTUP.mpp, but you can use any valid filename.






2. Click Tools>Macros>Record New Macro.  In the Macro Name box, type Auto_Open, and under Store Macro In, select This Project (very important!). Click OK.



3. Since you are going to simply type in your macro code later, just click Tools>Macro>Stop Recorder.


4. Click Tools>Macro>Macros (or Alt+F8). 


5. Select  the Auto_Open Macro from the list, and click Edit to get to the Visual Basic Editor.


6. In the Module Editor, enter the code that you want to be run each time Microsoft Project is started. In this case, I used the following code to make the STARTUP.mpp file close itself right after opening (change it to your filename if you chose something other than STARTUP.mpp; the name in the macro code MUST match the name of the file).
   Projects("STARTUP.mpp").Activate
   FileClose save:=pjDoNotSave

7. In the Visual Basic Editor, click Save, then click the red X to close it.

8. In MS Project, click Save to save changes to STARTUP.MPP.

9. Before you quit MS Project, you MUST set your Macro Security to Low or the Auto_Open macro will NOT run automatically.  (Another option is to use the Self-Cert Tool so you can keep your security on High, but it only works on one computer; see here for how to use the Self-Cert Tool.)


10. Close MS Project.

11. Test your file by double clicking on the STARTUP.mpp file that you just created. 

It should launch MS Project, briefly flash the blank project, and then close the project, leaving you with a blank gray window of MS Project. 

If it leaves STARTUP.mpp open, and doesn't close it, you likely need to adjust your Macro Security Level as in Step 9 above.



NOTE: If you do not want the Auto_Open macro to run, press and hold the SHIFT key when you click on the STARTUP.MPP file to open it.


12. If all looks good, protect your file by making it Read-Only.
a. In Windows Explorer, right-click on the STARTUP.mpp, and click Properties.
b. On the General tab, check off the Read-only box, and click OK.

Action 2: Create Custom Program Shortcut

Place your file in a safe location, and create a new program shortcut that accesses that file when opening MS Project.

1. I suggest placing your STARTUP.mpp file in the MS Office Program Folder so it doesn't get accidentally deleted, and so it's easy to link to in the following steps.  The Program Folder is the same place that WINPROJ.exe is located (WINPROJ.exe is the MS Project program executable).

Here are the paths depending on which version of MS Project you are using:
 MS Project Version  
 Path on 32-bit Operating Systems
 Path on 64-bit Operating Systems
 MS Project 2010
 C:\Program Files\Microsoft Office\Office14  C:\Program Files (x86)\Microsoft Office\Office14
 MS Project 2007
 C:\Program Files\Microsoft Office\Office12  C:\Program Files (x86)\Microsoft Office\Office12
 MS Project 2003
 C:\Program Files\Microsoft Office\Office11  C:\Program Files (x86)\Microsoft Office\Office11


I am using MS Project 2007, so I will navigate to C:\Program Files\Microsoft Office\Office12, and place my STARTUP.mpp file there. (Note that this is also the location of WINPROJ.exe).


2. Follow the steps below to create a program shortcut that accesses your STARTUP.mpp file (do NOT use just a shortcut to the file; reasons below).

a. Right-click on your desktop, and select New>Shortcut.


b. In the Wizard, type this code exactly including quotation marks depending on your MS Project Version and Operation system:

 MS Proj Vers.
 32-Bit OS
 64-bit OS
 2010"C:\Program Files\Microsoft Office\Office14\WINPROJ.EXE" "C:\Program Files\Microsoft Office\Office14\STARTUP.mpp""C:\Program Files (x86)\Microsoft Office\Office14\WINPROJ.EXE" "C:\Program Files (x86)\Microsoft Office\Office14\STARTUP.mpp"
 2007"C:\Program Files\Microsoft Office\Office12\WINPROJ.EXE" "C:\Program Files\Microsoft Office\Office12\STARTUP.mpp""C:\Program Files (x86)\Microsoft Office\Office12\WINPROJ.EXE" "C:\Program Files (x86)\Microsoft Office\Office12\STARTUP.mpp"
 2003"C:\Program Files\Microsoft Office\Office11\WINPROJ.EXE" "C:\Program Files\Microsoft Office\Office11\STARTUP.mpp""C:\Program Files (x86)\Microsoft Office\Office11\WINPROJ.EXE" "C:\Program Files (x86)\Microsoft Office\Office11\STARTUP.mpp"

In my specific case using MS Proj 2007 on 32-bit, my screen looked like this:


c. Name the Shortcut something.  I chose "MS Project 2007 (no Proj1)." (no quotes)

d. You will notice that the shortcut icon becomes the MS Project Program Icon (not just an MS Project file icon).

e. Drag this new shortcut to your Quick Launch bar (on XP), or your Taskbar on Windows 7.







Note that in step 2b. above, if you did not include the first half of the string in your shortcut code (e.g. "C:\Program Files\Microsoft Office\Office12\WINPROJ.EXE"), or if you simply made a file shortcut, you will not be able to pin the shortcut to the Taskbar as a separate icon.  A File shortcut will only pin to a Program shortcut as a separate link that you can only get to by right clicking the Program shortcut.  However, if you include all of the code in step 2b., then it will be a Program shortcut that references a specific file to open, and can be pinned directly to the Windows 7 taskbar.

(This process modified from http://support.microsoft.com/kb/128622)




Handy Modifications

Assign Shortcut Key to Program Shortcut

You can assign a shortcut key to your new Program Shortcut.  The shortcut must be in the Start Menu, or on the Desktop, or in the Taskbar on Win7 or Quick Launch bar on XP.  Shortcut keys do not work in other locations.  Just right-click to get into the properties for that shortcut, and type any letter that you have not already assigned to another shortcut.  The screenshots below are for Win 7, but the process is essentially the same in XP.




Use Self-Cert to keep Macro Security High on one Computer

If you are doing this trick on a single machine, and you want to keep your macro security set to High, you can self certify the macro for a single machine using SelfCert.exe.  It is located in the MS Office Program folder, which is the same place as the WINPROJ.exe, and where you placed the STARTUP.mpp in Action 2 above.  On my Windows 7 32-bit machine it is here:


1. Double click SelfCert.exe, name your certificate, and click OK.



2. Open your STARTUP.mpp project by HOLDING SHIFT while you open STARTUP.mpp (by either clicking your custom Program shortcut that opens STARTUP.mpp, or double-clicking the actual file itself.)  By holding shift until MS Project is completely booted, you will prevent the Auto_Open macro from running, and keep STARTUP.mpp open.

3. In the STARTUP.mpp, click Tools>Macro>Macros.  Then select the Auto_Open macro, and click Edit.



4. In the Visual Basic Editor, click Tools>Digital Signature. 

Then Click Choose. 

Then select your certificate


Then your macro will be signed


5. Click Save in the Visual Basic Editor, Close it, then Click Save in the STARTUP.mpp project and close it.

6. You can now increase your Macro Security back to Med or High (by reversing step 9 under Action 1 above), and the next time you open STARTUP.mpp, it will ask you if you want to trust that certificate.  If you choose to Trust, then the Auto_Open macro will work everytime even with your security set to high.

NOTE: Be aware that this ONLY WORKS ON THE COMPUTER WHERE THE CERTIFICATE WAS MADE.  If you put your STARTUP.mpp file on another computer you will not have the option to trust the macro/certificate.  Microsoft has made the SelfCert.exe certificates good for only one computer (personal use only).



Put STARTUP.mpp on Project Server

If you are on a Project Server environment, you can save the STARTUP.mpp on the Project Server, but you will have to modify both the macro in the project, and the desktop shortcut.

MACRO CODE CHANGE
Change the macro code in the project to the following (assuming you will name the project "STARTUP" when placed on Project Server).


Projects("STARTUP").Activate
FileCloseEx pjDoNotSave, , True


Using the FileCloseEx method allows you to force the project to be checked in when closed.  That is what the "True" part of the code does.

DESKTOP SHORTCUT CHANGE
Change your desktop shortcut to open the STARTUP file from the server instead of the STARTUP.mpp from your C drive.  This is the code for MS Project 2007 on 32-bit OS:

"C:\Program Files\Microsoft Office\Office12\WINPROJ.EXE" "<>\STARTUP"

The part that tells it to open the project from the server is the "<>\STARTUP"   You can use this technique to create desktop shortcuts to other Project Sever projects if you wish; just use similar syntax, and change the project name from STARTUP to your desire project name.

Again, you have to customize the first part of the shortcut code depending on your MS Project Version and OS.  Just use the table below to change the first half of the code accordingly:
 MS Project Version  
 Path on 32-bit Operating Systems
 Path on 64-bit Operating Systems
 MS Project 2010
"C:\Program Files\Microsoft Office\Office14\WINPROJ.EXE" "C:\Program Files (x86)\Microsoft Office\Office14\WINPROJ.EXE"
 MS Project 2007
"C:\Program Files\Microsoft Office\Office12\WINPROJ.EXE" "C:\Program Files (x86)\Microsoft Office\Office12\WINPROJ.EXE"
 MS Project 2003
"C:\Program Files\Microsoft Office\Office11\WINPROJ.EXE" "C:\Program Files (x86)\Microsoft Office\Office11\WINPROJ.EXE"

POTENTIAL ISSUES WITH THIS METHOD
Issue 1: In my environment, I noticed that if I opened the STARTUP project with my Macro Security set to High, it would not only disable the Auto_Open macro, but would actually completely delete it from the STARTUP project, and seemingly corrupt the file such that it hung MS Project when trying to close.  This means that if another user were to accidentally open the project with High Macro Security, they would kill the macro that makes that project useful.  Because of this, I reverted to the C: drive location for the STARTUP.mpp project.  I have not yet done any testing to see if there is some sort of workaround for this.

Issue 2: If many users are trying to access MS Project, and thus the STARTUP file, at the same time, you could end up with a situation where the file is not fully checked in when the second user tries to access it.  The second user will get the following error prompt about opening Read-Only.  This may cause unnecessary confusion, and is another good reason to stick with keeping the STARTUP.mpp on the C: drive: