Table of contents
TOC
Collapse the table of content
Expand the table of content

Document.MasterShortcuts Property (Visio)

office 365 dev account|Last Updated: 6/12/2017
|
1 Contributor

Returns the MasterShortcuts collection for a document stencil. Read-only.

Syntax

expression . MasterShortcuts

expression A variable that represents a Document object.

Return Value

MasterShortcuts

Example

This Microsoft Visual Basic for Applications (VBA) macro shows how to use the MasterShortcuts property to get the collection of master shortcuts in a document stencil.

Before running this example, replace the reference to StencilWithShortucts.vss with a reference to a valid .vss file that contains master shortcuts.

To create a stencil that contains master shortcuts:

  1. Open an existing stencil. (In the Shapes window, click More Shapes, click Open Stencil, and then double-click a stencil.)

  2. Right-click a master in the stencil and click Copy.

  3. Create a new stencil. (In the Shapes window, click More Shapes, and then click New Stencil (US Units) or New Stencil (Metric).)

  4. Right-click the new stencil and click Paste Shortcut.

  5. Save the new stencil. (Right-click its title bar and click Save.)

In the following code, replace StencilWithShortcuts.vss with the name of your new stencil.


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
© 2017 Microsoft