Document.MasterShortcuts 属性 (Visio)

返回文档模具的 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 支持和反馈,获取有关如何接收支持和提供反馈的指南。