DocumentBase.Redo Method (Object)

 

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

Namespace:   Microsoft.Office.Tools.Word
Assembly:  Microsoft.Office.Tools.Word.v4.0.Utilities (in Microsoft.Office.Tools.Word.v4.0.Utilities.dll)

public bool Redo(
	ref object times
)

Parameters

times
Type: System.Object

The number of actions to be redone.

Return Value

Type: System.Boolean

true if the actions were redone successfully.

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

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);
}
Return to top
Show: