

You might have to change the security settings so that your macro can work. I have found that if your project file has macros, then you might have trouble using this macro because of Microsoft built in security. The last comment I want to make is that about the project file you might be trying to open. Of course, this is just the staring code where it just opens the Microsoft Project, you will need to write more code to do what you want it to do. I took out most of my file path to not make it confusing Where you see “C:\\My Example Project.mpp”, this is where you put the information on where YOUR file is located. Set projApp = GetObject(, "MSProject.Application") This way if your VBA doesn’t run correctly, you won’t lose valuable information. When trying out new code I recommend you use it on copies of your projects and not on active projects. NOTE: Every time you run a new Macro / VBA script you run a risk of losing all your work. This means we can now access everything we need in MS Project. We set projApp to be a new instance of the object type. This way the code stops running and you don’t get an error.

I use the On Error Resume next in case MS Project is not installed and an error occurs. You will need one variable for your MS Project application, which I called projApp. Make sure to first set up your variables, which in this script you only need one. Let’s start by opening a Microsoft Project file from Excel. Now you are ready to start coding in Excel to access information from Microsoft Project. Ready to Access Microsoft Project from Excel

You can build a procedure Sub in your VBA Editor after you add a new Module to your current workbook.īefore starting to write your code, make sure you have the right references to access Microsoft Project! Click on Tools>References>Microsoft Project xx.x Object Library. If you need it for an earlier version, it should be similar, so play around with the code.

This script should work at minimum for current versions of Microsoft Project. Recently I’ve been playing around on how to open a Microsoft Project file using Excel with VBA.
