會取消復原上一個動作或指定數目的動作。 對應至當您選擇 Standard 工具列上 [重做] 按鈕旁的箭號時出現的項目清單。 呼叫這個方法會反轉 Undo 方法。
語法
運算式。重做 (計數)
運算式 代表 Document 物件的變數。
參數
| 名稱 | 必要/選用 | 資料類型 | 描述 |
|---|---|---|---|
| Count | 選用 | Long | 指定要取消復原的動作數目。 預設值為 1,這表示若省略,則只會取消復原上一個動作。 |
傳回值
無
註解
如果在重做堆疊上沒有任何動作,或 Count 大於目前位於堆疊上的動作數時呼叫, 則 Redo 方法會盡可能重做更多的動作,並忽略其餘的動作。
呼叫 Redo 一次,最多可取消復原 20 個動作。
範例
下列範例使用 Redo 方法來重做透過 Undo 方法復原已復原的動作子集。
第 1 部分會在使用中的出版物的第四頁建立包含文字框架的矩形。 設定各種字型屬性,並將文字新增至文字框。 在此案例中,「此字型是 Courier」文字會設定為 12 點粗體的 Courier 字型。
第 2 部分測試是否文字圖文框中的文字為新細明體字型。 否則會使用 [復原 ] 方法來復原復原堆疊上的最後四個動作。 接著會使用 Redo 方法來重做剛剛復原的最後四個動作中的前兩個。 在此例中第三個動作 (設定字型大小) 且 (設定字型設為粗體) 的第四個巨集指令會取消復原。 字型名稱再變更為新細明體,並修改的文字。
Dim thePage As page
Dim theShape As Shape
Dim theDoc As Publisher.Document
Set theDoc = ActiveDocument
Set thePage = theDoc.Pages(4)
' Part 1
With theDoc
With thePage
' Setting the shape creates the first action
Set theShape = .Shapes.AddShape(msoShapeRectangle, _
75, 75, 190, 30)
' Setting the text range creates the second action
With theShape.TextFrame.TextRange
' Setting the font size creates the third action
.Font.Size = 12
' Setting the font to bold creates the fourth action
.Font.Bold = msoTrue
' Setting the font name creates the fifth action
.Font.Name = "Courier"
' Setting the text creates the sixth action
.Text = "This font is Courier."
End With
End With
' Part 2
If Not thePage.Shapes(1).TextFrame.TextRange.Font.Name = "Verdana" Then
.Undo (4)
With thePage
With theShape.TextFrame.TextRange
' Redo redoes the first two of the four actions that were just undone
theDoc.Redo (2)
.Font.Name = "Verdana"
.Text = "This font is Verdana."
End With
End With
End If
End With
支援和意見反應
有關於 Office VBA 或這份文件的問題或意見反應嗎? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應。