共用方式為


Document.Redo 方法 (Publisher)

會取消復原上一個動作或指定數目的動作。 對應至當您選擇[標準] 工具列上[取消復原] 按鈕旁邊的箭號時所顯示的專案清單。 呼叫這個方法會反轉 Undo 方法。

語法

運算式重做 (計數)

表達 代表 Document 物件的變數。

參數

名稱 必要/選用 資料類型 描述
Count 選用 Long 指定要取消復原的動作數目。 預設值為 1,這表示若省略,則只會取消復原上一個動作。

傳回值

註解

如果在重做堆疊上沒有動作時呼叫,或 Count 大於目前位於堆疊上的動作數目時呼叫, 則 Redo 方法會盡可能重做多個動作,並忽略其餘的動作。

呼叫 Redo 一次,最多可取消復原 20 個動作。

範例

下列範例會使用 Redo 方法來重做使用 Undo 方法復原的動作子集。

第 1 部分會建立一個矩形,其中包含使用中出版物第四頁上的文字圖文框。 會設定各種字型屬性,並將文字新增至文字圖文框。 在此情況下,「此字型為 Courier」文字設定為 12 點粗體 Courier 字型。

第 2 部分測試是否文字圖文框中的文字為新細明體字型。 如果沒有,則會使用 Undo 方法來復原復原復原堆疊上的最後四個動作。 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 支援與意見反應