Share via


DocumentBase.Redo(Object) Method

Definition

Performs the last action that was undone (reverses the Undo(Object) method).

public bool Redo (ref object times);
member this.Redo : obj -> bool
Public Function Redo (Optional ByRef times As Object) As Boolean

Parameters

times
Object

The number of actions to be redone.

Returns

true if the actions were redone successfully.

Examples

The following code example adds three words to the document, calls the undo method twice, and then calls the redo method once. Two words are left in the document. To use this example, run it from the ThisDocument class in a document-level project.

private void DocumentRedo()
{
    object undoTime = 2;
    object redoTime = 1;
    this.Paragraphs[1].Range.InsertParagraphBefore();
    
    this.Application.Selection.TypeText("New ");
    this.Application.Selection.TypeText("text ");
    this.Application.Selection.TypeText("here.");

    this.Undo(ref undoTime);
    this.Redo(ref redoTime);
}
Private Sub DocumentRedo()
    Dim undoTime As Object = 2
    Dim redoTime As Object = 1
    Me.Paragraphs(1).Range.InsertParagraphBefore()

    Me.Application.Selection.TypeText("New ")
    Me.Application.Selection.TypeText("text ")
    Me.Application.Selection.TypeText("here.")

    Me.Undo(undoTime)
    Me.Redo(redoTime)
End Sub 

Remarks

Optional Parameters

For information on optional parameters, see Optional Parameters in Office Solutions.

Applies to