共用方式為


Document.UndoActions Publisher (Available 屬性)

傳回可用的動作數目上復原堆疊。 唯讀的 Long

語法

運算式UndoActionsAvailable

表達 代表 Document 物件的變數。

傳回值

Long

範例

下列範例會在使用中出版物的第四頁新增含有文字框的矩形。 某些字型屬性及文字框的文字已經設定。 接著測試文字框中的字型是否為 Courier。 如果是,會使用 Undo 方法,同時傳入 UndoActionsAvailable 屬性值做為參數,將之前所有動作指定為復原。

接著會使用 Redo 方法,並以 RedoActionsAvailable 屬性減 2 的值做為參數,取消復原最後兩個之外的所有動作。 新的字型除了指定給新的文字外,也會指定給文字圖文框中的文字。

本範例假設使用中檔至少包含四頁。

Dim thePage As page 
Dim theShape As Shape 
Dim theDoc As Publisher.Document 
 
Set theDoc = ActiveDocument 
Set thePage = theDoc.Pages(4) 
 
With theDoc 
 With thePage 
 Set theShape = .Shapes.AddShape(msoShapeRectangle, _ 
 75, 75, 190, 30) 
 With theShape.TextFrame.TextRange 
 .Font.Size = 12 
 .Font.Name = "Courier" 
 .Text = "This font is Courier." 
 End With 
 End With 
 
 If thePage.Shapes(1).TextFrame.TextRange.Font.Name = "Courier" Then 
 .Undo (.UndoActionsAvailable) 
 .Redo (.RedoActionsAvailable - 2) 
 With theShape.TextFrame.TextRange 
 .Font.Name = "Verdana" 
 .Text = "This font is Verdana." 
 End With 
 End If 
End With

支援和意見反應

有關於 Office VBA 或這份文件的問題或意見反應嗎? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應