Workbook.RunEvent
use this function to execute the event.
| Syntax | Parameters | Return value |
|---|---|---|
| - | This function has no parameters. | This function does not return a value. |
SVB Example
Adding and running document-level events in a workbook
Option Base 1
Option Explicit
Sub Main
Dim wb As WorkBook
Set wb = WorkBooks.New("New Workbook")
'insert a function into the workbook that will
'display a message box whenever it
'is activated
wb.EventCode = _
"Private Sub Document_Activate()" & vbCrLf & _
"MsgBox(EventSource.Name & "" now activated"",vbExclamation)" & _
vbCrLf & "End Sub"
wb.Visible = True
wb.RunEvent()
End Sub
Copyright © 2020. Cloud Software Group, Inc. All Rights Reserved.
