How to manage code modifications among multiple users using Project.mpt or Global.mpt RRS feed

  • Question

  • Hi,

    There is one copy of a Template.mpt file in the shared drive. Users copy this file to their project folder for a specific project and they save it as Project_n.mpp. There is only one Project_n.mpp file per project. So whoever works on the particular project will always open the same Project_n.mpp file. There is a lot of projects that users work on and each of them has its respective Project1.mpp, Project2.mpp, Pproject3.mpp etc.file.

    These files contain modules that are called on the Project Open and some of them on the Project Close. Current code in modules is used to update the project file with data from a database and also to update database with the data from the project file.

    I am looking now into the solution on how to incorporate any future modifications of the modules so that it can be applied to all project files.

    If I modify code in any of the modules of the Template.mpt file that is on the Shared drive I am now sure that modifications will apply only to the new projects (when user initiate the Project_n.mpp and starts from the Template.mpt). But in the case of already created project files (Project1.mpp, Project2.mpp, Project3.mpp) I also want to apply the modified code in modules, but currently when I open them I have the old code.

    I tried using Global.mpt file but ran into some issues such as if I move all modules to the global.mpt the functions called from ThisProject/Project Open are ending having errors since they are not defined. Is there any way of specifying in the project that modules are defined in the Global.mpt.

    I also tried to Move modules from Template.mpt file to the Project_n.mpp file on the opening. Before moving modules I deleted them to avoid having to answer to the question "Do you want to replace the file?", but then some modules wouldn't get deleted right away because functions that are called in the Project.mpp open event are defined in the modules I want to delete. They get deleted at the end of the code execute and that causes issues when code runs again.

    I would appreciate any help, suggestion on how to solve this issue. I am open to any proposition in regards how to share modifications among all users and previous and future projects.

    Thanks in advance.

    Tuesday, March 25, 2014 1:07 PM

All replies

  •  Well, it certainly sounds like you could use Project Server, rather than standalone Project and MPP files stored on hard drives. This would be a perfect example of why Project Server was developed.  Some of the features that may address your needs are...

    Project Server permits the creation of "template" schedules, so that users create new projects from existing Templates on the server. There can be as many as you like - different templates for different types of schedules. Users have a drop down menu to select which "type" of project they want to create. There are other items that can be associated to the project creation.

    Project Server also has workflow, which can perform actions (on the server side, not the desktop) to help manage the Project Management process flow.

    Project Server allows many users to access the same copy of the schedule via a check-out (for editing) / check-in mechanism. This ensures that everyone is seeing the current and accurate version of the schedule.

    Project Server allows you to automatically keep "archived" versions of your published schedules for backup / restore purposes.

    Project Server stores all project information in a SQL server database which permits you to use standard SQL tools to transfer data in / out.

    Finally, Project Server still uses a Global.mpt, which is stored in the database and every user gets an automatic update of that file each time they open a project from the server (they get a local copy, which updates with any changes) so that all changes to Global MPT are pushed out to all project users.

    It sounds like you may benefit from Project Server Online, which is quick and relatively cost effective.

    Pay close attention to your data transfer needs, this area is getting better, but may or may not meet your requirements.

    Finally, work with a Microsoft Partner who has "been there and done that" so you get the most benefit from Project Server.

    Hope that helps,

    Thanks, Eric S. Pcubed

    • Edited by ErockP3 Tuesday, March 25, 2014 4:24 PM
    Tuesday, March 25, 2014 4:21 PM
  • Assuming Project Server isn't available (and it would make things much easier) I would create a separate module for the update code.

    The file_open and close code should just call a sub that lives in a standard module. That makes it much easier to upgrade.

    I would create a table in the database that holds the latest version of code. One of the modules (not the update code module) needs a function that has a constant in it that has the version number. Now your code can determine what version the code is and from the db what the latest is. This test should be run each time Project opens.

    If the code needs updating, open a copy of the latest .mpt file (which should have latest code).

    Copy all modules using organizermoveitem with application.DisplayAlerts=false (reset to true afterwards).

    All code should be in Global.mpt so updates happen once per install, not once per file.

    Rod Gill
    Author of the one and only Project VBA Book

    Tuesday, March 25, 2014 8:15 PM
  • Thank you very much for your reply.

    Project Server option is not available, but would help definitely.

    Rod, your answer is very close to what I am trying to do. My code is already organized in modules. I like the idea of saving the latest code version in the database to be able to update on "per need" basis.

    application.DisplayAlerts=false works well, I don't get any messages. Modules get replaced and some of them RENAMED, which creates another issue.

    From Project_Open I call 3 sub procedure:

    CodeUpdate (which has a code to move modules), UnableEvents, UpdateProjectData 

    Before moving modules from the latest .mpt I check if the modules exist and I delete them. But modules where UnableEvents and UpdateProjectDatareside do not get deleted at first. So when my Move code gets executed the modules having these subs get renamed and it creates an issue. They get name modPublic1 and UpdateTemp1 (previously modPublic and UpdateTemp). Is there any way to avoid module renaming? Or how to make sure that all modules are deleted at first instance and updated with new moved modules?

    Also I am not sure I understood what role Global.mpt plays in here since I am copying modules from my Template.mpt.

    Thanks a lot

    Wednesday, March 26, 2014 11:27 AM
  • I've had the module copy problem as well. I think from memory a second copy works and I delete copies (whether they exist or not).

    Make sure you have the latest Service Pack installed.

    Copying to the Global.mpt on one PC makes the macros available to all projects. So only one update per PC is needed rather than one per project.

    Having master copies of modules in the template file is good, one place and one place only (apart from backups :-) ) for them.

    Rod Gill
    Author of the one and only Project VBA Book

    Thursday, March 27, 2014 1:16 AM
  • Thanks a lot.

    Just to make sure I understood. 

    You suggest:

    - keep code modules only in the template.mpt.

    - when a project.mpp file is opened it should run the validation code to see if the code in template.mpt has changed

    - if code has changed run the UpdateCode procedure that will move modules from template.mpt to Global.mpt for that user. Project.mpp reads the code from users's Global.mpt. So the modules shouldn't be part of the project.mpp file at all.

    The following procedures (with the code only in the Global.mpt) are all called from Private Sub Project_Open(ByVal pj As Project) in This Project:

    -validation of the code version

    -Code module update that runs if code has changed

    -my procedures for the update of the database and project file

    Please let me know if any of the steps are misunderstood?

    Thursday, March 27, 2014 11:07 PM
  • No, only keep original master copies of modules in template. Everyone's Global.mpt needs a copy of the modules.

    Rod Gill
    Author of the one and only Project VBA Book

    Thursday, March 27, 2014 11:55 PM
  • Once you've got your standard global file defined (i.e. the one which all your users should be using) you can write a little batch file that moves it into the right place in the users profile.

    Then to refresh a users global file, they just run the batch file and it installs for them (no need for admin privileges). You could even schedule the batch file to run at start-up to ensure they're all working with common code.

    I've got a sample which I wrote for 2010 - get in touch at the email address below if you want a copy.

    Andrew Simpson
    Founder – Eversight Ltd


    Download Eversight for MS Project — a free add-on which helps users build high quality schedules with MS project.

    Friday, March 28, 2014 4:38 PM
  • I have done all as instructed, but the procedure calls I have in Project_Open are not recognized (since I moved all modules to Global.mpt). The code doesn't compile now. I believe I am still missing something.

    Thanks Andrew for your reply I will email you.

    • Edited by DDrag Sunday, March 30, 2014 4:19 PM
    Sunday, March 30, 2014 4:19 PM
  • Can you post the snippet of code for calling a sub in the Global and a snippet of the code in the global (include sub declaration).

    You're doing something wrong as I have code in my Global all the time without a problem.

    Rod Gill
    Author of the one and only Project VBA Book

    Sunday, March 30, 2014 10:24 PM
  • I got it! What I was trying to do is to call global modules from the project.mpp (I wanted to call modules only when I open these files, not any other unrelated .mpp) I could have seen why my code didn't work, but couldn't figure out how it works for you. Well now I see why:) you are calling your modules from global file. I just now have to figure out how to deal with the current existing .mpp files that already have the code in the project.mpp since this code takes priority over the one in the Global file. Thanks for your help. I appreciate it.
    Monday, March 31, 2014 11:07 AM