none
Project_Open Event not called when .mpp is opened from a web page RRS feed

  • Question

  • I have an .mpp file on a SharePoint web page.  When I click on it to open, the code within the Project_Open event does not execute (although it does execute the Project_Active event).  If I open the file directly from my desktop, Project_Open and Project_Activate run fine.  Does anyone know why this is happening?  Here is my code...

     

    Private Sub Project_Open(ByVal pj As Project)

        ScreenUpdating = False

        DeleteFunctionToolbar

        AddFunctionToolbar

        CommandBars("Functions").Visible = True

        ScreenUpdating = True

    End Sub

     

    Wednesday, July 13, 2011 8:15 PM

All replies

  • I think that's by design. Some events don't trigger when the application is initiated/opened from another.

    Rod Gill

    The one and only Project VBA Book Rod Gill Project Management
    Wednesday, July 13, 2011 8:20 PM
    Moderator
  • Thanks for the reply Rod.  Not sure if you remember me, but I chatted with you several months ago.

    Anyway, if that is the way it is intended to work, how can I differentiate between the different ways a project file can be opened?  When a file is opened, I want it to do this:

        ScreenUpdating = False

     

        DeleteFunctionToolbar

        AddFunctionToolbar

        CommandBars("Functions").Visible = True

        ScreenUpdating = True

     

     

    And when a user navigates from one project to another (Project_Activate), I want it only to do this:

        CommandBars("Functions").Visible = True

     

    It seems like I need to modify my Project_Activate event to something like this...

     

     

    Private Sub Project_Activate(ByVal pj As Project)

     If Project File is open directly, then

      CommandBars("Functions").Visible = True

     Else if Project File is opened from another application, then

    ScreenUpdating = False

           DeleteFunctionToolbar

      AddFunctionToolbar

      CommandBars("Functions").Visible = True

      ScreenUpdating = True

     End If

     

    End Sub

     

     

    Is this how you would approach the problem?  If so, what would the code look like?


    Wellyn
    Wednesday, July 13, 2011 8:29 PM