Visio) (Document.AddUndoUnit 方法
將支援 IOleUndoUnit 或 IVBUndoUnit 介面的物件新增至 Microsoft Visio 復原佇列。
語法
運算式。addUndoUnit (pUndoUnit)
表達 代表 Document 物件的變數。
參數
名稱 | 必要/選用 | 資料類型 | 描述 |
---|---|---|---|
pUndoUnit | 必要 | [UNKNOWN] | 物件的參考,此物件會支援 IOleUndoUnit 或 IVBUndoUnit 介面。 |
傳回值
無
註解
如需在物件上實作 IOleUndoUnit 介面的詳細資訊,請參閱 MSDN 網站上的 Microsoft Platform SDK。 如需實作 IVBUndoUnit 介面的詳細資訊,請參閱 MSDN 上的<開發 Microsoft Visio 解決方案>(英文)。
範例
下列程式示範如何使用 AddUndoUnit 方法,將物件新增至 Visio 復原佇列。 當圖形加入至使用中檔時,程式會檢查它是否因為復原或取消復原動作而加入,如果沒有,則會加入復原單位。
此程式是 clsParticipateInUndo類別的成員,該類別定義于 Visio SDK 中程式碼範例程式庫的兩個相關類別模組之一,並不適合獨立執行。 (另一個類別模組定義 類別 clsVBUndoUnits.) 如需這些課程模組的詳細資訊,請參閱 MSDN 上的 Visio SDK。
Private Sub mvsoDocument_ShapeAdded(ByVal vsoShape As IVShape)
Dim VBUndoUnit As clsVBUndoUnits
On Error GoTo mvsoDocument_ShapeAdded_Err
If Not (mvsoApplication Is Nothing) Then
If Not msvoApplication.IsUndoingOrRedoing Then
'Increment the count of undoable actions.
IncrementModuleVar
Debug.Print "Original Do: GetModuleVar = " & GetModuleVar
'Instantiate clsVBUndoUnit, a
'class that implements Visio.IVBUndoUnit.
Set VBUndoUnit = New clsVBUndoUnits
'Pass the current instance of the class
'of which this procedure is a member,
'clsParticipateInUndo, to the Undo unit.
VBUndoUnit.SetModelObject Me
'Add an Undo unit.
mvsoApplication.AddUndoUnit VBUndoUnit
End If
End If
Exit Sub
mvsoDocument_ShapeAdded_Err:
MsgBox Err.Description
End Sub
支援和意見反應
有關於 Office VBA 或這份文件的問題或意見反應嗎? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應。