Graph.AddEvent

Adds event code from the specified file to the document.

Syntax Parameters Return Value
Sub Graph.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 a document-level event to a graph:

Option Base 1
Option Explicit
Sub Main
    'Whenever the graph is right clicked on,
    'a Henon Strange Attractor will appear
    ActiveGraph.AddEvent(Path & _
        "\Examples\Macros\Graph Examples\Henon Strange Attractor.svb")
    ActiveGraph.EventCode = ActiveGraph.EventCode & vbCrLf & _
        "Private Sub Document_BeforeRightClick(ByVal Where As Long, Cancel As Boolean)" & _
        vbCrLf & "main" & vbCrLf & "End Sub"
    ActiveGraph.RunEvent
End Sub