共用方式為


Visio) (Document.MasterShortcuts 屬性

會傳回檔樣板 的 MasterShortcuts 集合。 唯讀。

語法

運算式MasterShortcuts

表達 代表 Document 物件的變數。

傳回值

MasterShortcuts

範例

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

執行此範例之前,請將 StencilWithShortcuts.vss 的參考取代為包含主要快捷方式的有效 .vss 檔案參考。

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

  1. 開啟現有的樣板。 (在 [ 圖形] 視窗中,依序按一下 [ 更多圖形] 和 [ 開啟樣板],然後按兩下樣板。)

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

  3. 建立新的樣板。 (在 [ 圖形] 視窗中,按一下 [ 更多圖形],然後按一下 [ 新增樣板 (US Units) ] 或 [新增樣 板 (度量) .)

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

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

在下列程式碼中,將 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 支援與意見反應