Visio) (Document.MasterShortcuts 屬性

傳回文件樣板的 MasterShortcuts 集合。 唯讀。

語法

運算式。MasterShortcuts

運算式 代表 Document 物件的變數。

傳回值

MasterShortcuts

範例

下列的 Microsoft Visual Basic for Applications (VBA) 巨集會示範如何使用 MasterShortcuts 屬性來取得文件樣板中的主圖形捷徑的集合。

在執行此範例之前,請將 StencilWithShortcuts.vss 的參照取代為包含主要快速鍵的有效 .vss 檔案的參照。

若要建立包含主圖形捷徑的樣板:

  1. 開啟現有樣板。 (在 [ 圖形 ] 視窗中,按一下 [其他圖形],按一下 [ 開啟樣板],然後按兩下樣板。)

  2. 以滑鼠右鍵按一下樣板中的主圖形,然後按一下 [複製]。

  3. 建立新的樣板。 (在 [ 圖形 ] 視窗中,按一下 [其他圖形],然後按一下 [新增樣板 (美國單位) ] 或 [ 新增樣板 (公制) .)

  4. 在新樣板上按一下滑鼠右鍵,然後按一下 [貼上捷徑]。

  5. 儲存新的樣板。 (以滑鼠右鍵按一下其標題列,然後按一下 [儲存]。)

在下列程式碼中,以新樣板的名稱取代 StencilWithShortcuts.vss 。

 
Public Sub MasterShortcuts_Example() 
  
    Dim vsoMasterShortcuts As Visio.MasterShortcuts  
    Dim vsoMasterShortcut As Visio.MasterShortcut  
    Dim vsoStencil As Visio.Document  
 
    'Get a stencil that contains some shortcuts.  
    Set vsoStencil = Application.Documents ("StencilWithShortcuts.vss ")  
    Set vsoMasterShortcuts = vsoStencil.MasterShortcuts 
  
    For Each vsoMasterShortcut In vsoMasterShortcuts 
  
        'Print some of the more common properties of a  
        'master shortcut to the Immediate window.  
        With vsoMasterShortcut  
            Debug.Print .AlignName  
            Debug.Print .DropActions  
            Debug.Print .IconSize  
            Debug.Print .ID  
            Debug.Print .Index  
            Debug.Print .Name  
            Debug.Print .NameU  
            Debug.Print .ObjectType  
            Debug.Print .Prompt  
            Debug.Print .ShapeHelp  
            Debug.Print .Stat  
            Debug.Print .TargetDocumentName 
  
            'Original master where shortcut points  
            Debug.Print.TargetMasterName  
 
        End With          
 
    Next  
 
End Sub

支援和意見反應

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