Document.UndoActionsAvailable Property (Publisher)

Returns the number of actions available on the undo stack. Read-only Long.


expression. UndoActionsAvailable

expression A variable that represents an Document object.

Return Value



The following example adds a rectangle that contains a text frame to the fourth page of the active publication. Some font properties and the text of the text frame are set. A test is then run to determine whether the font in the text frame is Courier. If so, the Undo method is used with the value of the UndoActionsAvailable property passed as a parameter to specify that all previous actions be undone.

The Redo method is then used with the value of the RedoActionsAvailable property minus 2 passed as a parameter to redo all actions except for the last two. A new font is specified for the text in the text frame, in addition to new text.

This example assumes the active document contains at least four pages.

Dim thePage As page 
Dim theShape As Shape 
Dim theDoc As Publisher.Document 
Set theDoc = ActiveDocument 
Set thePage = theDoc.Pages(4) 
With theDoc 
 With thePage 
 Set theShape = .Shapes.AddShape(msoShapeRectangle, _ 
 75, 75, 190, 30) 
 With theShape.TextFrame.TextRange 
 .Font.Size = 12 
 .Font.Name = "Courier" 
 .Text = "This font is Courier." 
 End With 
 End With 
 If thePage.Shapes(1).TextFrame.TextRange.Font.Name = "Courier" Then 
 .Undo (.UndoActionsAvailable) 
 .Redo (.RedoActionsAvailable - 2) 
 With theShape.TextFrame.TextRange 
 .Font.Name = "Verdana" 
 .Text = "This font is Verdana." 
 End With 
 End If 
End With