Udostępnij za pośrednictwem


DocumentBase.Redo Method

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)

Syntax

'Declaration
Public Function Redo ( _
    ByRef times As Object _
) As Boolean
public bool Redo(
    ref Object times
)

Parameters

Return Value

Type: System.Boolean
true if the actions were redone successfully.

Remarks

Optional Parameters

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

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 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 
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);
}

.NET Framework Security

See Also

Reference

DocumentBase Class

Microsoft.Office.Tools.Word Namespace