Share via


Open Event

Occurs when the project opens, but before the Activate event.

Syntax

Private Sub Project_Open(ByVal pj As MSProject.Project)

pj     The project that was opened.

Remarks

Microsoft Office Project 2003 events do not occur when the project is embedded in another document or application.

Example

This example adds the user's e-mail alias and the current date to a project's Comments field whenever it is opened. Placing this example in the Open event of a project would provide a simple access history for the file.

Private Sub Project_Open(ByVal pj As MSProject.Project)
    Dim Alias As String
    
    Alias = InputBox$("Please enter your e-mail alias: ")
    pj.ProjectSummaryTask.AppendNotes vbCrLf & "Opened by " & Alias & _
        " on " & Date$ & "."
End Sub

Applies to | Project Object, Projects Collection Object

See Also | Activate Method | NewProject Event