Share via


MasterShortcuts Property [Visio 2003 SDK Documentation]

Returns the MasterShortcuts collection for a document stencil.

objsRet = object**.MasterShortcuts**

objsRet     The MasterShortcuts collection for a document.

object     Required. An expression that returns a Document object.

Version added

2000

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. (On the File menu, point to Shapes, point to a solution folder, and then click a stencil.)
  2. Right-click a master in the stencil and click Copy.
  3. Create a new stencil. (On the File menu, point to 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

Applies to | Document object