CanUndo Property

Microsoft Office Web Components Visual Basic

True if there is a previous action that can be undone. Read-only Boolean.

expression.CanUndo

expression    Required. An expression that returns one of the objects in the Applies To list.

Example

This example undoes the last action performed or displays a message box if the action cannot be undone.

Sub Undo_Action()
    If Spreadsheet1.CanUndo Then
        Spreadsheet1.Undo
    Else
        MsgBox "Can't undo last action."
    End If
End Sub