The discussion so far has been about creating procedures in the ThisProject object for the VBAProject project, but that might not always be the best place to create procedures. In deciding where to create procedures, you should think about what the code is meant to do and whether you want to distribute your code to other people.
Depending upon your needs and the type of code you're writing, you should create procedures in the following areas: h
• The ProjectGlobal project, if you want your procedures available for every plan you work with. Procedures in the ProjectGlobal project are associated with the Global file, g which is opened every time you start Microsoft Project.
• The VBAProject project, if the procedures are used only for that particular plan. Procedures in the VBAProject project are associated with that particular plan and are available to anyone who opens the plan.
• A code module, if you want to be able to easily distribute the code to other people. Modules can be easily distributed because they are not associated with any particular plan and can be imported into a project as needed. Also, because they are not associated with any plan, modules are a good place to store general "utility" code.
Note To add an existing module to a project, right-click the project in the Project Explorer, click Import File, and then browse to the file that you want to insert.
Was this article helpful?
What you need to know about… Project Management Made Easy! Project management consists of more than just a large building project and can encompass small projects as well. No matter what the size of your project, you need to have some sort of project management. How you manage your project has everything to do with its outcome.