Macro called from ribbon doesn't save project RRS feed

  • Question

  • Hi

    At a client (Project Server 2013) we wrote a macro that will prepare projects for archiving, checking some business rules, publish the project, save the project as a MPP, and then opening the enterprise project again, changing a custom field indicating it can be deleted, saving and publishing. 

    At about the same time we wrote a macro that recalculated a set of projects and published.

    Both macros exhibits the same issue. In the first one FileSave is called, about 3 times, and the second one it is called once.
    When the macro is called from the View Macros, and clicking on Run, or by pressing F5 or F9 in the VB editor, it works fine.
    However, if you add a button to the ribbon that calls the macro, it doesn't save. Doesn't matter what parameters is sent, if it is called from the ribbon it doesn't save. 

    The macro definitely makes changes to the schedule, as if you let it run but don't close the project, and then close it manually, you will be prompted to save.

    I thought that it might be some of the macros that runs on Project_Save that might be preventing it, but I removed all of the other macros and it didn't make a difference, as there was a fix in the October 2015 update that mentions it, but updating to November 2015 didn't make a difference either.

    Does anyone have an idea what might be the problem?

    Here is the recalc code, the sub is called from a form that displays a list of projects and then loops through the selected projects. Doesn't matter if I'm using FileCloseEx or FileSave, it doesn't work:

    Public Sub RecalculateProject(ProjectName As String)
    On Error GoTo ErrHandler
        Dim strProject As String
        strProject = "<>\" & ProjectName
        Application.FileOpen (strProject)
        Application.FileCloseEx pjSave, False, True
        Exit Sub
        LogInformation "Error occurred while processing project '" & ProjectName & "': " & Err.Description & " in " & " in "
    End Sub

    • Edited by MandarbZA Saturday, December 12, 2015 10:11 AM Forgot the PS version
    Saturday, December 12, 2015 10:10 AM

All replies