none
MPS 2003 macros don't work in MSP 2010 RRS feed

  • Question

  • We have a large number of complex macros that have been developed over the years in MSP 2003.  We are moving onto MSP 2010 but I have found that a few of the macros don't work in MSP 2010.  I am currently going through them to see if I can fix them for MSP 2010.  One of the ones that I am having problems with is where the macro sets up a number of cost rates for resources and also changes the cost rate table used.  I have stepped through the code and it all works as it does in MSP 2003 until it gets to the "End Sub" of the macro and all the changes revert back to as they were before.  Has anybody any idea why it would do that?  Why should this be different for MSP 2010?  I have Microsoft Project Professional 2010 SP1.  Thank you.
    Tuesday, April 14, 2015 8:31 AM

Answers

  • For those who may be following this thread.

    While in the process of analyzing the Hilary's macros, she reported that the issue was found. Why it only applied to the case when the macro was executed from a custom ribbon button versus running the macro from the macro list is still unknown. However, the basic problem is likely related to the major overhaul of Project from Project 2007, an earlier, to Project 2010.

    In this particular case the macro cycled through each of Project's 5 cost rate tables to update the rates using this code snippet:

    For Each Res In ActiveProject.Resources
            For Each ass In Res.Assignments
                ass.CostRateTable = rateTableUsed
            Next ass
    Next Res.

    In older versions of Project (i.e. Project 2007 & earlier) those rate tables can be referenced by the string designation of "A","B","C","D" & "E". However, that no longer is true. The tables are now referenced using a numerical designation of "0","1","2","3" and "4".

    Hope this helps anyone who may have a similar issue.

    John

    • Marked as answer by Hilary Mould Tuesday, June 9, 2015 3:47 PM
    Tuesday, June 9, 2015 3:30 PM

All replies

  • Hilary,

    To answer your question, no it shouldn't do that. However, only having Project 2010 updated to SP1 is an issue. At a minimum, you need to have SP2 and I also recommend you go ahead and update Project 2010 with the latest cumulative update (now called Public Updates). To get more information and links for the updates, see: http://blogs.technet.com/b/projectsupport/p/msp10.aspx.

    If you still have an issue after the updates are installed, post back.

    Hope this helps.

    John

    Tuesday, April 14, 2015 3:01 PM
  • John,

    Thanks for replying so quickly.  I have just loaded SP2 and it doesn't make any difference.  The hotfixes state that they are only intended to fix specific problems and none of the problems mentioned are anything to do with what I have seen, so I don't think that they will make any difference. 

    Tuesday, April 14, 2015 4:02 PM
  • Hilary,

    Yes, that is correct about cumulative updates and I didn't used to recommend that users install them but there have been many fixes that address crashes and a couple that address VBA issues. Now I think the possibility of issues occurring due to installation of not quite fully tested cumulative updates is very small compared to the potential benefits.

    That being said, your macros written under Project 2003 should still work fine with Project 2010. You say you stepped through the code and everything works as expected but it all resets upon execution of the End Sub statement. Try setting a breakpoint on the End Sub line. Now let the macro run and at the breakpoint, look at the cost rates to see if everything is updated. If not, put your breakpoint back further until you can find the point of reset.

    Does the macro in question reside in the file or is it in your Global? That was a change between Project 2010 VBA and earlier versions, although I don't see why that would make a difference.

    My support will be a bit sporadic this afternoon.

    John

    Tuesday, April 14, 2015 7:46 PM
  • Hilary,

    After thinking about it for a while, was the resource rate escalation macro written by you or by someone named "John"? Reason I asked is because I wrote just such a macro for someone several years ago using Project 2003. And as a little test, I took a Project 2003 file with the macro and opened it in Project 2010. Without any modification to the code, it worked perfectly under Project 2010 (i.e. rates were escalated and stayed that way after the macro completed),

    John

    Wednesday, April 15, 2015 4:06 PM
  • John,

    Sorry, I didn't reply yesterday, I was away. 

    I put a breakpoint on the End Sub line and everything updated as expected, but then I let it run and it reverts back to as it was.

    The macro resides in my Global.mpt.

    Thanks for you help in this matter.

    Hilary

    Thursday, April 16, 2015 7:29 AM
  • John,

    The resource rate macro was written in house.

    Hilary

    Thursday, April 16, 2015 7:33 AM
  • Hilary,

    Okay, so everything works fine up until the actual execution of the End Sub but then all updates are lost? It would be helpful to see the code. Can you post it, or at least a snippet towards the End Sub. If you don't want to or cannot share it publicly would you be willing to send it to me so I can take a look at it? If so, I'll give you my address.

    Are you working in a Project Server environment? Is the project 2010 file you are trying to update just a regular file (i.e. not part of a linked structure such as a pool/sharer or master/subproject)?

    Is the macro a single entity (i.e. one procedure) or does it have a userform associated with it?

    John

    Thursday, April 16, 2015 3:24 PM
  • John,

    Yes, everything works fine until the actual execution of the End Sub and then all updates are lost.  I will need to modify the code before I send it to you as it has sensitive data in it, so it will be tommorrow before I can send it to you (it's 5.30pm here).  Could you give me your address so that I can send it to you please?

    We have Project Professional but do not connect to a server, we were using it as part of a Proof Of Concept and will go onto server eventually.  This is all part of making sure that everything works before we make the change.

    The project 2010 file is just a regular file.

    The macro is not a single entity, it is a number of modules and has a userform associated with it.

    Thanks,

    Hilary

    Thursday, April 16, 2015 4:29 PM
  • Hilary,

    Okay, thanks for the additional information. I won't be able to look at your macro until tomorrow anyway.

    Send the zipped file with the module and userform to the address below. It would be good to have module attached to your mock-up Project file that you are using for proof-of-concept, that way I can more easily troubleshoot. However, if the size of the zipped file is more than 1 Meg, just send me a introductory e-mail without the file and I'll give you an alternate address. My main e-mail server has attachment limitations. I will ask some questions.

    jensenljatatfastmaildotdotfm

    (remove obvious redundancies and the 7th character is a letter)

    John

    Thursday, April 16, 2015 6:00 PM
  • John,

    Whilst creating a project file with the modules in to send to you, I discovered that the code works when it is run from the project file rather than from my Global.mpt file.  So why would the same code work when run from a project file but not work when run from my Global.mpt file?

    I also got someone else to try running it from his Global.mpt file and it works OK for him - he has an XP machine and mine is Windows 7, would that make a difference?

    As I said earlier, we are running Project Professional 2010 but are not connected to a server, but when I use organizer to try to copy modules into my Global.mpt file. it doesn't work and I get the error "You cannot copy modules from a project into the enterprise global template".  The file selected in the drop down box in the Organizer dialog box is Global.MPT, so I'm not sure why it thinks it is copying to the enterprise global file.  I can copy modules OK using the VBA Project Explorer.  When I select File, Info, under Project Server Accounts it says "Not connected to Project Server".  When I select Manage Accounts it just has "Computer" in the Available accounts.  From the error message it looks to me that it thinks it is connected to the Project Server, but I can't figure out why.

    Many thanks for all the help you've provided so far and the offer of looking at the code.  If you can shed any light on the above, that would be great.

    Hilary

    Friday, April 17, 2015 10:01 AM
  • Hilary,

    Interesting. Unfortunately I don't do Project Server so I can't explain why the module "thinks" it's in a server environment. This is what I would do. In Project 2010 open the VB Editor for the module causing problems. Copy the entire module and paste it into a new blank module. Now see if you can transfer that new module to your Global. If so, delete the original module.

    If the above doesn't not solve the problem, let me know and I'll see if I can get one of my fellow responders who does know something about Project Server to help you.

    Hope this helps.

    John

    Friday, April 17, 2015 1:48 PM
  • John,

    I've already tried that and it doesn't work.  I think it must be something to do with how my MSP is set up.  If you could ask one of you fellow responders who knows about Project Server to help me, that would be great.

    Thanks,

    Hilary

    Sunday, April 19, 2015 9:01 AM
  • Hilary,

    Okay. I contacted Rod Gill, our resident VBA guru who also knows a lot more about Project Server than I do. Hopefully, he will check in within the next 24 hours.

    John

    Sunday, April 19, 2015 2:52 PM
  • I'm thinking that the Global.mpt file is corrupt given it runs on some else's PC.

    Try finding your Global.mpt file and rename it Global.oldmpt with Project closed.

    Open Project again and a new Global.mpt will be created. Try copying the module to it and run again.

    You may want to copy all modules, custom Views, calendars etc to a new .mpp file before renaming it so you can copy from the new file to the new global.

    Strongly recommend Project 2010 SP2 and I would install all updates as well. They install automatically now if you run Windows update.

    With project Server, all rates need to be set for the Enterprise resources because every time a project is opened, rates revert to the Enterprise resource rates on server.


    Rod Gill
    Author of the one and only Project VBA Book
    www.project-systems.co.nz

    Sunday, April 19, 2015 11:04 PM
    Moderator
  • Rod,

    Thanks very much for getting involved and offering advice.

    Unfortunately I can't do exactly as you say as, since going to Windows 7, we have been unable to delete our Global.mpt file as they are stored on our profile in AppSense.  If we delete the global.mpt (or copy a new one in), when we open MSP it just gets overwritten with the one stored in AppSense.  Our IT department has written an app so that we can backup and restore our global.mpt file, so I have taken the global.mpt file from a colleague that works and imported that in but that doesn't make any difference, it still doesn't work for me.

    I have also got another colleague (who has Windows 7) to try the code out and it works for him.

    I have Project 2010 SP2 now but I haven't installed any of the hotfixes.  I believe my colleague has only SP1.

    I don't know anything about Project Server, but it seems to me that my MSP thinks I am connected to the server.  I can't copy any modules into my Global.mpt using Organizer, it fails and has the error "You cannot copy modules from a project into the enterprise global template....". 

    Thanks once again, and hopefully you can help me.

    Hilary

    Monday, April 20, 2015 8:55 AM
  • Hilary,

    Have you tried un-installing and re-installing Project 2010? Note, when you do so, you will have to update Project again. Based on previous responses on this thread, a corrupt Project installation seems to be the only thing that hasn't been mentioned/tried.

    John

    Monday, April 20, 2015 2:25 PM
  • John,

    I haven't tried that, I was hoping not to have to go down that route.  I can't do that myself, I will have to go via our IT department, which means it will take a while to process (probably about a week).

    I thought I would try connecting to the server and then disconnecting, just to make sure it has disconnected OK (not that I've ever connected from this PC), but when I went to add an account - File, Info, Manage Accounts, Add, it won't let me put anything in for Account Name and Project Server URL.  So, something's not correct there.  I think I will have to get our IT department involved.

    Hilary

    Monday, April 20, 2015 3:19 PM
  • Hilary,

    Okay, let us know if a re-install helps.

    John

    Monday, April 20, 2015 5:59 PM
  • Unfortunately locking the Global.mpt file disables some features that are very useful. For example all Views, Tables etc copied to the Global file are available to all your projects.

    I suspect the Global stored in AppSense may well be corrupted. Get your IT team involved and try re-installing Project. If they won't let you write to the Global.mpt file then copy a clean version of the Global.mpt file to the folder that holds your project files or folders.

    Create a shortcut on the desktop.

    Edit the properties of the shortcut and copy the path for the Global.mpt folder into the Start in field of properties. Start Project using this shortcut and it will use the Global.mpt file in the Start in folder. Now you can save to it.


    Rod Gill
    Author of the one and only Project VBA Book
    www.project-systems.co.nz

    Monday, April 20, 2015 10:13 PM
    Moderator
  • John,

    I've just had our IT department clear out my AppSense area and re-install MSP 2010 and it still doesn't work. 

    Hilary

    Tuesday, April 21, 2015 2:53 PM
  • Rod,

    I've just had my IT department clear out my AppSense area and re-install MSP 2010 and it still doesn't work.  Clearing out my AppSense area still left my Global.mpt file as it was, so I'm not convinced it was cleared out properly.

    I've restored an old Global.mpt file - one that works with MSP 2003 and it still doesn't work.  I've also done as you suggested - use a shortcut on my desktop to start MSP 2010 to force it to take the Global.mpt from a particular folder - that doesn't work either.  How do you get a clean version of the Global.mpt file?  I've just used old versions of my Global.mpt file that I know work with MSP 2003.

    I don't think it's my Global.mpt file (as I've tried numerous ones).  I think it's the way MSP 2010 is set up on my PC.  I've got both MSP 2003 and MSP 2010 installed on my PC, that shouldn't cause a problem should it? 

    I've got my IT department looking into it now.  Hopefully they'll be able to sort it, although they're a bit puzzled at the moment. 

    Thanks again for your help.

    Hilary

    Tuesday, April 21, 2015 3:16 PM
  • Hilary,

    Okay, if you have both versions of Project installed, it's possible the Global files are getting "confused". On the other computers that do not have a problem (i.e. the macros work fine), are both both versions of Project also installed? I suspect not. You might try un-installing Project 2003 and just have Project 2010 installed. That should eliminate any Global issues.

    Project 2010 was a major format change from previous versions. Although in some cases a user might be able to have Project 2010 and an earlier version both installed, I wouldn't recommend it.

    For reference, I have 4 separate virtual machines - one for Project 98 and Project 2000, one for Project 2003, one for Project 2007, and one for Project 2010. I rarely need to, but if per chance I need to take a Project 2003 file and move it to Project 2010, I start both virtual machines and then drag and drop the file form one to the other.

    Hope this helps.

    John

    Tuesday, April 21, 2015 10:48 PM
  • If sharing files between versions, essential to have P2003 on SP3 and P2010 on SP2. I would apply all cumulative updates as well.

    Rod Gill
    Author of the one and only Project VBA Book
    www.project-systems.co.nz

    Wednesday, April 22, 2015 3:51 AM
    Moderator
  • John,

    I can see that I have two Global.mpt files - one for MSP 2003 and one for MSP 2010, so I don't think they are getting "confused".  I have tested it on another computer that had both MSP 2010 and MSP 2003 and it worked OK on that - although he had MSP 2010 Standard rather than Professional, which is what I have. 

    I don't really want to un-install MSP 2003 as I need that as well, but maybe I should try it to see if it makes a difference.

    I don't think I could use virtual machines as the macros we use need to "talk" to other applications on my computer.

    Thanks,

    Hilary


    Thursday, April 23, 2015 8:22 AM
  • Rod,

    I have MSP 2003 SP2 and MSP 2010 SP2.  We had problems with MSP 2003 SP3 so we use SP2.

    Thanks,

    Hilary

    Thursday, April 23, 2015 8:27 AM
  • Hilary,

    I don't know what kind of problems you might have had with Project 2003 SP3 but as Rod said, it is imperative to have SP3 if you are going to share plans with later versions of Project.

    By the way, did you try un-installing Project 2003 and then running your macros in Project 2010 as I suggested? Note, once you un-install Project 2003, it would be a good idea to re-install Project 2010.

    John

    Thursday, April 23, 2015 4:16 PM
  • John,

    I haven't tried it yet, I'm waiting on our IT department to get back to me.  I'll let you know the outcome.

    Hilary

    Thursday, April 23, 2015 4:56 PM
  • Completely agree with John. You can expect problems sharing files between different versions if they are not at the latest service pack and probably latest cumulative update as well.

    No need to re-install Project 2010 after removing Project 2003, but do a Repair instead.


    Rod Gill
    Author of the one and only Project VBA Book
    www.project-systems.co.nz

    Friday, April 24, 2015 12:14 AM
    Moderator
  • My IT department has fixed it - it took a while!  They had to rest all my MS office settings and reset my profile on AppSense.  The macro now works for me and I can now copy modules into my Global.mpt using the Organizer. 

    Thank you to both of you for looking into this for me. 

    • Marked as answer by Hilary Mould Monday, April 27, 2015 3:21 PM
    • Unmarked as answer by Hilary Mould Monday, June 1, 2015 10:47 AM
    Monday, April 27, 2015 12:19 PM
  • Hilary,

    You're welcome and thanks for the update. Give yourself credit for the answer on this one.

    John

    Monday, April 27, 2015 2:29 PM
  • I have an update on the problem that I had.  When I said that it was fixed and the macro worked for me, I thought it was, but unfortunately I have found a problem with it.  If I run the macro using the View Macros button on the View tab and then select the macro, it works.  But if I create a button for the macro (either via the Customize Ribbon method or by creating XML code to create the button) I get the same problem that I had before, i.e. it works all the way until the last "End Sub" and then the changes revert back to as it was before.

    Has anyone else come across this problem whereby a macro works if called directly, but doesn't work if called from a button on the ribbon?

    Monday, June 1, 2015 10:52 AM
  • Hilary,

    No, I've never had that issue.

    Since it's been a while since this thread began, let's back track a bit. Are you now running totally on Project 2010? If so, is Project 2010 fully updated (i.e. latest public update of May 2015)? If you are still sharing between Project 2003 and Project 2010, is Project 2003 updated with SP3.

    If you create a new simple macro (e.g. "Hello world"), does it work fine whether initiated from the View Macros window or from a custom button on the ribbon? When you step through the code, when initiated from your custom button, what is the state of your variables just before the End Sub statement and when that statement is executed (i.e. what do you mean by "revert back to as it was before)?

    John

    Monday, June 1, 2015 2:31 PM
  • Hi John,

    Thanks for replying again.  I am still running with Project 2003 and Project 2010.  Project 2010 is fully updated - I've just updated it now and I still get the problem.  Project 2003 is at SP2 as we have problems with SP3.

    A simple macro works fine whether initiated from the View Macros window or from a custom button on the ribbon, in fact I have a number of complex macros that work fine whichever way they are initiated.

    When I step through the code, all the variables get updated as expected, but as soon as the End Sub statement is run they all return to as they were before the macro was run.

    Hilary

    Monday, June 1, 2015 3:14 PM
  • Hilary,

    Okay but I'll have to repeat that if you are going to work between Project 2003 and Project 2010, it is imperative that Project 2003 be updated with SP3. Otherwise, all bets are off. I know you said your "had problems" with SP3 for Project 2003, but you weren't specific and you likely will face bigger issues if you continue to work between versions without having all versions fully updated. Just saying.

    With regard to your macros, so are you saying that one particular macro, or perhaps just a couple, have the issue but all others work okay? If so, what does/do that/those particular macros do? Can you post the code, or if it's a large complex macro, would you be able to send one to me? It will be real difficult to troubleshoot without more detail.

    One other thought, you "solved" the problem initially by having your IT department reset your Office and log-in profile. Is it possible that those items are corrupt again and need resetting? Of course, if that is the case, then there's a bigger issue as to why things go awry in the first place.

    John

    Monday, June 1, 2015 5:16 PM
  • John,

    Sorry for the delay in replying, I was off yesterday.

    MSP SP3 introduced changes to security and we found that we couldn't open some of our schedule when SP3 had been installed, so that's why we don't use it.

    I have just had a problem (so far) with this particular macro.  The macro changes the rates of our resources.  I will try and send it to you.

    I have a further update.  I managed to find someone else to test it.  This person uses MSP 2003 via a Microsoft Application Virtualization Desktop Client, i.e. not directly installed on his PC, and he has MSP 2010 installed on his PC.  He gets the same results that I do, i.e. when run from a button created on the ribbon the macro doesn't work properly (reverts back to old values on "End Sub"), but when run from the View Macros window it works correctly.

    Someone else tested it for me as well.  He has MSP 2003 and MSP 2013 loaded onto his PC.  He gets the same results as me when he tested it in MSP 2013.

    I am currently trying to find someone who just has MSP 2010, without a persistent or virtual version of MSP 2003, to test it.

    I thought the problem had been solved when my IT department reset my Office settings, but that's only because I was testing the macro by calling it from the View Macros window because when my profile was reset all my created buttons disappeared.  My IT department has reset my Office setting a number of times now and that's when we noticed that it worked when called from the View Macros window and not from a button on the ribbon.

    Thanks

    Hilary

    Wednesday, June 3, 2015 12:46 PM
  • For those who may be following this thread,

    Hilary did send me her files and they are in my testing "queue". I will update this thread when I finish testing.

    John

    Wednesday, June 3, 2015 3:58 PM
  • For those who may be following this thread,

    I did testing with the files Hilary sent me and indeed I can confirm the problem she reports, namely, the macro works fine when run by selecting from the list of macros but doesn't not work when run from a custom button on the ribbon using Project 2010.

    The macros are rather complex with several intertwined procedural flows, (i.e. this sub calls that sub which calls another sub, etc.), so it is taking some time to break it all down. I'm about half way through that process and will provide an update when I'm done.

    John

    Monday, June 8, 2015 2:58 PM
  • For those who may be following this thread.

    While in the process of analyzing the Hilary's macros, she reported that the issue was found. Why it only applied to the case when the macro was executed from a custom ribbon button versus running the macro from the macro list is still unknown. However, the basic problem is likely related to the major overhaul of Project from Project 2007, an earlier, to Project 2010.

    In this particular case the macro cycled through each of Project's 5 cost rate tables to update the rates using this code snippet:

    For Each Res In ActiveProject.Resources
            For Each ass In Res.Assignments
                ass.CostRateTable = rateTableUsed
            Next ass
    Next Res.

    In older versions of Project (i.e. Project 2007 & earlier) those rate tables can be referenced by the string designation of "A","B","C","D" & "E". However, that no longer is true. The tables are now referenced using a numerical designation of "0","1","2","3" and "4".

    Hope this helps anyone who may have a similar issue.

    John

    • Marked as answer by Hilary Mould Tuesday, June 9, 2015 3:47 PM
    Tuesday, June 9, 2015 3:30 PM