DocumentBase.Redo 方法

執行復原的最後動作 (回復 Undo 方法)。

命名空間:  Microsoft.Office.Tools.Word
組件:  Microsoft.Office.Tools.Word.v4.0.Utilities (在 Microsoft.Office.Tools.Word.v4.0.Utilities.dll 中)

語法

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

參數

  • times
    型別:System.Object%
    要取消復原的動作數目。

傳回值

型別:System.Boolean
如果順利取消復原動作,則為 true。

備註

選擇性參數

如需選擇性參數的詳細資訊,請參閱Office 方案中的選擇性參數

範例

下列程式碼範例會將三個字加入至文件中,接著呼叫復原方法兩次,然後呼叫取消復原方法一次。 文件中會剩下兩個字。 若要使用這個範例,請在文件層級專案中的 ThisDocument 類別執行。

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 安全性

請參閱

參考

DocumentBase 類別

Microsoft.Office.Tools.Word 命名空間