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.
0 Comments
Leave a Reply. |