Szerkesztés

Megosztás a következőn keresztül:


Document.MasterShortcuts property (Visio)

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:

  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

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.