and Spreadsheet
objects, undoes the last single action or the last macro block surrounded by BeginUndo
and EndUndo
method calls.
For the DataPage object, restores the data access page to the condition before the recordset was edited if the edits have not been saved.
expression.Undo
expression An expression that returns a ChartSpace, DataPage, or Spreadsheet object.
Example
This example undoes the last action or displays a message box if this action cannot be undone.
If Spreadsheet1.CanUndo Then
Spreadsheet1.Undo
Else
MsgBox "can't undo last action"
End If