UndoAction method (Microsoft Forms)

Reverses the most recent action that supports the Undo command.

Syntax

Boolean = object. UndoAction

The UndoAction method syntax has these parts:

Part Description
object Required. A valid object.

Remarks

The Undo command in the user interface uses the UndoAction method. For example, if you paste text into a TextBox, you can use UndoAction to remove that text and restore the previous contents of the TextBox.

Not all user actions can be undone. If an action cannot be undone, the Undo command is unavailable following the action.

Note

If the CanUndo property is False, the Undo command is not available in the user interface, and UndoAction is not valid in code.

If UndoAction is applied to a form, all changes to the current record are lost. If UndoAction is applied to a control, only the control itself is affected.

You must apply this method before the form or control is updated. You may want to include this method in a form's BeforeUpdate event or a control's Change event.

UndoAction is an alternative to using the SendKeys statement to send the value of Esc in an event procedure.

See also

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.