This event procedure runs whenever the user runs a spreadsheet command. If the user tries to insert columns on the specified worksheet, the procedure displays a message box and cancels the command. Note that the 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.ssInsertColumns Then
MsgBox "you cannot insert columns on this sheet"
EventInfo.ReturnValue = False
End If
End Sub