Share via


Document.Undo Event

Publisher Developer Reference

Occurs when a user undoes the last action performed.

Syntax

expression.Undo

expression   A variable that represents a Document object.

Remarks

The Undo event occurs immediately after the action is undone.

If multiple actions are undone, the Undo event occurs only once, after all the actions are undone.

For more information about using events with the Document object, see Using Events with the Document Object.

Example

This example displays a message when the user clicks Undo on the Standard toolbar or selects Undo from the Edit menu. For this routine to work with the current publication, you must put it in the ThisDocument module.

Visual Basic for Applications
  Private Sub DocPub_Undo()
    MsgBox "Your last action has been reversed."
End Sub

To trap this event from a non-Microsoft Office Publisher project, you must place the following code in the General Declarations section of your module and run the InitiatePubApp routine.

Visual Basic for Applications
  Private WithEvents DocPub As Publisher.Document

Sub InitiatePubApp() Set DocPub = Publisher.ActiveDocument End Sub

See Also