Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I save the customized commands?

Status
Not open for further replies.

olivia919

Programmer
May 19, 2005
24
US
I have a simple form created in my global template. I added the command to the menu,click save. it is working all fine. But I once close the project,and get back in again, my customized the command button on the menu disappears. What did I do wrong? please help!!!
Thank you for your help!!!
 
Did you first of all click on Tools | Organizer and copy the maps, tables, views, modules, etc. from the project to Global.MPT?

If you did then you (as I'm sure you've already guessed) will have to write some code to bring them from Global.mpt to your project each time. Look at the Project_Open event in Global.MPT.
 
Hi, Thank you for your help. My global.mpt is orginally created in Project 98. Now my computer only has Project 2002. I think part of the problem is due to the version difference. I did a test, create a new project in 2002, write a simple macro,add it on the menu bar and save. it is still not there when i re-open it. what should i write in Project_open event? any suggestions..:)thank you!
 
For those just joining:

This is a two-stage process that works for me. Might be slightly cumbersome, might even have a few steps that aren't actually needed (but I've only done this stuff a couple of times -- it's not that common a task) but it works for me.

Also ... one of the environments I work in (the one I'm in right now, actually) has locked down Global.MPT so that it cannot be updated. Because of that, I have to "fiddle" loading Global.mpt (see the end of this message).

Stage 1
1. Create macros, forms, buttons, etc.
2. Tools | Organizer... and manually copy the items you created from your project into Global.MPT
3. Exit from project

This should have moved all of your customizations from the active project into Global.MPT. You can confirm this by
4. Start | Programs | Project to load an empty project
5. Tools | Organizer and then, at the bottom of the popup make certain that one of the two windows shows GLOBAL.MPT. If it isn't showing then click on the downward pointing triangle on either side and select GLOBAL.MPT.
6. In turn, click on the various tabs Calendars, Toolbars ... etc., and monitor the contents in the scroll box on the popup. If you're missing something then you goofed up above in step 1 (when you created them) or step 2 (when you copied them into Global.MPT).

In theory (and, I think, in practice) opening any project from now on should show those items (they are, after all, in Global.MPT).

If they still don't appear, you have two choices:

7. Manaully copy them from Global.MPT to your project (The reverse of step 2 above: Tools | Organizer ... select them in GLOBAL.MPT and copy them to your project);

8. OR write some code to do this.
8a. Alt+F11 to open the VBA editor
8b. In the left panel, look for the bold item VBAxxxxxxx (where xxxxxxx is replaced by your project file name)
8c. Double-click on the Microsoft Project Objects folder to open it
8d. Double-click on ThisProject
8e. In the upperright panel, set the first dropdown to Project and set the second dropdown to Open
8f. Add the following code

Dim strPrjName As String
strPrjName = MSProject.ActiveProject.Name & ".MPP"

Then add variations on the theme of:

OrganizerDeleteItem Type:=pjModules, FileName:=strPrjName, Name:="Module2"
OrganizerMoveItem Type:=pjModules, FileName:="GLOBAL.MPT", ToFileName:=strPrjName, Name:="Module2"

Depending on what you are deleting and copying you'll need these constants
pjModules, pjViews, pjTables, pjFilters, pjToolbars
and you'll need to make sure that you are deleting and copying the appropriate pairs of Constants (pjModules) and module names (in this case it was called "Module2").

That should pretty much solve your problem.


 
Thank you!!! I will try and see if it works for me. ;)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top