Report.AddEvent

Adds event code from the specified file to the document.

Syntax Parameters Return value
Sub Report.AddEvent( _
    FileName As String)
FileName [in]

Filepath of the spreadsheet or macro to copy the document level events from.

Type: String

This function does not return a value.

SVB Example

Adding event code to a report:

Option Base 1
Option Explicit
Sub Main
    Dim rpt As New Report
    'the new report will run the Eta-Tran example whenever you right click on it.
    rpt.AddEvent(Path & _
        "\Examples\Macros\Analysis Examples\Eta-Tran.svb")
    rpt.EventCode = rpt.EventCode & vbCrLf & _
        "Private Sub Document_BeforeRightClick(where As Integer, Cancel As Boolean)" & _
        vbCrLf & "main" & vbCrLf & "End Sub"
    rpt.RunEvent
    rpt.Visible = True
End Sub