This example displays a message box if the user tries to export the specified spreadsheet and then cancels the command. Note that the event procedure in this example is declared as required by Visual Basic. For more information about using event procedures, see Declaring and Using Event Procedures.
Private Sub Spreadsheet1_BeforeCommand(ByVal EventInfo As OWC.SpreadsheetEventInfo)
Set c = Spreadsheet1.Constants
If EventInfo.Command = c.ssExport Then
MsgBox "you cannot export this spreadsheet"
EventInfo.ReturnValue = False
End If
End Sub