none
Macro Problem in Vista RRS feed

  • Question

  • I have a macro that uses two userforms. It operates without problems on XP and versions of MS Project up to and including 2007. One of my users is working in Vista with MS Project 2002 and is having problems with the macro. Initially, he got a MS Visual Basic error message stating "Compile error in hidden module: <modulename>". (I have the module locked for security reasons.) He rebooted and tried the module a second time, getting a different error message: "Error in loading DLL." He has no problems running a similar hidden (i.e., locked) macro that does not employ userforms.

    I'd appreciate help resolving this, as I'm no Vista expert.


    RobVV
    Wednesday, January 5, 2011 1:02 AM

Answers

  • Hi Rob,

    Try 'Vba.Chr' instead of 'Chr'.
    Does this make a difference?

    Hans


    My EPM blog: Projectopolis
    • Marked as answer by RobVV Friday, January 7, 2011 2:20 PM
    Thursday, January 6, 2011 12:03 AM
    Moderator
  • Hi Rob,

    The Chr function (and others) are sometimes also available in other libraries. Depending on the libraries available on the client machine, things can get mixed up causing core functions to fail if you do not explicitely specify the library to use.

    Another option is that one or more of the references used are not available on the other systems. Missing references can cause other libraries and even core functions to fail to load or behave incorrectly. Explicitely specifying the library to use can solve this issue (but make sure there are no missing references to avoid other potential problems).

    Regards,
    Hans


    My EPM blog: Projectopolis
    • Marked as answer by RobVV Friday, January 7, 2011 2:16 PM
    Friday, January 7, 2011 12:26 PM
    Moderator

All replies

  • Hi RobVV,

    Have you checked the references of module in error? You might be using a reference that is not available on Vista (like non standard form elements).

    I hope this helps,
    Hans


    My EPM blog: Projectopolis
    Wednesday, January 5, 2011 8:02 AM
    Moderator
  • Thanks, Hans. I use late binding in the macro to avoid the need to set any special references (e.g., calls to Excel). Because the macro is locked, the user cannot check the references on his copy. Is there is a way he can check references without unlocking the module?
    RobVV
    Wednesday, January 5, 2011 1:52 PM
  • Hi Rob,

    You will need to unlock the module to open the references.
    Another option could be that the object you are trying to create is not available on the Vista machine.
    Finally, this can sometimes also be caused if not all variables have been declared.

    If possible, I would unlock the module, run the macro on the Vista machine to check on which line exactly it fails.

    I hope this helps,
    Hans


    My EPM blog: Projectopolis
    Wednesday, January 5, 2011 2:19 PM
    Moderator
  • I did as you suggested. The error message follows: "Compile error: Can't find project or library."

    It occurs on the assignment of line feeds to a declared variable:
    Dim TempLineFeeds as String
    TempLineFeeds = Chr(13) & Chr(13)  <--- The first occurrence of "Chr" is highlighted in the debugger.

    Does this mean one of the references is not set? Which one? Can it only be set manually?


    RobVV
    Wednesday, January 5, 2011 9:59 PM
  • Hi Rob,

    Try 'Vba.Chr' instead of 'Chr'.
    Does this make a difference?

    Hans


    My EPM blog: Projectopolis
    • Marked as answer by RobVV Friday, January 7, 2011 2:20 PM
    Thursday, January 6, 2011 12:03 AM
    Moderator
  • I'll make the arrangements to give it a try. In the meantime, here's another data point. The user ran the macro on his home computer which has XP and Project 2003. He uses Excel 2002 in both the XP/MSP2003 environment and in the Vista/MSP2002 environment. The macro makes Excel calls from within the Project VBA code. The user gets the same error message in both environments. Apparently, it is not related only to the operating system.
    RobVV
    Thursday, January 6, 2011 2:49 AM
  • Hans, we tried the fix you recommended, and it worked! Many thanks. I'd appreciate knowing, however, why you suggested it. Is the addition of VBA to Chr related to a Reference?
    RobVV
    Thursday, January 6, 2011 3:45 PM
  • Hi Rob,

    The Chr function (and others) are sometimes also available in other libraries. Depending on the libraries available on the client machine, things can get mixed up causing core functions to fail if you do not explicitely specify the library to use.

    Another option is that one or more of the references used are not available on the other systems. Missing references can cause other libraries and even core functions to fail to load or behave incorrectly. Explicitely specifying the library to use can solve this issue (but make sure there are no missing references to avoid other potential problems).

    Regards,
    Hans


    My EPM blog: Projectopolis
    • Marked as answer by RobVV Friday, January 7, 2011 2:16 PM
    Friday, January 7, 2011 12:26 PM
    Moderator
  • Thanks, Hans. That clarifies things nicely.
    RobVV
    Friday, January 7, 2011 2:21 PM