MS Project 2007 – Project Open Event with VSTO 3.0

Recently I got my self into a situation where I needed to develop a MS Project add-in using VSTO, but the fun doesn’t stop here. Also included in the package was the migration of some VB macros to the freshly developed add-in.

Because of this code migration I needed to perform some actions when opening a project file but I could not find an event handler at the application (add-in) level.

So here is how I ended up implementing it:

private void ThisAddIn_Startup(object sender, EventArgs e)
    this.Application.NewProject += 
        new MSProject._EProjectApp2_NewProjectEventHandler(

private void Application_NewProject(MSProject.Project pj)
    pj.Open += new MSProject._EProjectDoc_OpenEventHandler(

private void Project_Open(MSProject.Project pj)
    string message;
    message = String.Format("Opened project {0}.", pj.Name);


3 thoughts on “MS Project 2007 – Project Open Event with VSTO 3.0”

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s