Declaring and Using Event Procedures in VBScript

You declare event procedures in Visual Basic by using the Private and ByVal keywords and arguments with explicit type declarations, as shown in the following example.

Private Sub ChartSpace1_Click(ByVal ChartEventInfo As OWC.WCChartEventInfo)

This procedure declaration will not work in VBScript because VBScript does not use these keywords and because all arguments are passed as Variant. Instead, you declare event procedures in VBScript simply by using the event name and argument name, as shown in the following example.

Sub ChartSpace1_Click(ChartEventInfo)

The argument name itself is simply a convention in any container. By default, the argument in the preceding examples is called "ChartEventInfo", but you could use any argument name.

Caution   Some script editors (including Microsoft Script Editor) do not fill in the argument list when they create an event procedure. To ensure that your event procedure runs correctly, consult the Object Browser or the appropriate event topic in Help, and fill in the argument list yourself.