Spreadsheet.EventCode
This property returns/sets the event code of a document.
SVB Example
Adding and running document-level event code in a spreadsheet:
Option Base 1
Option Explicit
Sub Main
Dim spr As Spreadsheet
Set spr = Spreadsheets(1)
'insert a function into the spreadsheet that will
'display a message box whenever it
'is activated
spr.EventCode = _
"Private Sub Document_Activate()" & vbCrLf & _
"MsgBox(""Spreadsheet now activated"",vbExclamation)" & _
vbCrLf & "End Sub"
spr.RunEvent()
End Sub
Copyright © 2020. Cloud Software Group, Inc. All Rights Reserved.
