Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
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 StencilWithShortcuts.vss with a reference to a valid .vss file that contains master shortcuts.
To create a stencil that contains master shortcuts:
- Open an existing stencil. (In the Shapes window, click More Shapes, click Open Stencil, and then double-click a stencil.) 
- Right-click a master in the stencil and click Copy. 
- Create a new stencil. (In the Shapes window, click More Shapes, and then click New Stencil (US Units) or New Stencil (Metric).) 
- Right-click the new stencil and click Paste Shortcut. 
- 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
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.