DockedStencils Method [Visio 2003 SDK Documentation]
Returns the names of all stencils docked in a Microsoft Office Visio drawing window.
object**.DockedStencils**nameArray
object Required. An expression that returns a Window object.
nameArray Required String. Array that receives the names of stencils docked in a window.
Version added
4.5
Remarks
The DockedStencils method returns an array of strings—the names of the stencils shown in the docked stencil panes of a window. When the window is a drawing window, the number of docked stencil panes (n) is equal to or greater than zero, and n is zero when the window isn't a drawing window.
If the DockedStencils method succeeds, nameArray returns a one-dimensional array of n strings indexed from zero (0) to n - 1. The nameArray argument is an out argument that is allocated by the DockedStencils method, ownership of which is passed back to the caller. The caller should eventually perform the SafeArrayDestroy procedure on the returned array. Note that the SafeArrayDestroy procedure has the side effect of freeing the strings referenced by the array's entries. The DockedStencils method fails if nameArray is null. (Microsoft Visual Basic and Visual Basic for Applications take care of destroying the array for you.)
If strStencilName is the string returned by nameArray(StencilName), Documents.Item(strStencilName) succeeds and returns a Document object representing the stencil.
Example
The following Microsoft Visual Basic for Applications macro shows how to use the DockedStencils method to get the document names of all the stencils docked in the active window. It also prints, in the Immediate window, the name of the active document and the lower and upper bounds of the array that holds the stencil names, and then it lists the stencil names and paths, also in the Immediate window.
Public Sub DockedStencils_Example()
Dim astrStencilNames() As String
ActiveWindow.DockedStencils astrStencilNames
Dim intLowerBound As Integer
Dim intUpperBound As Integer
Dim intIndex As Integer
intLowerBound = LBound(astrStencilNames)
intUpperBound = UBound(astrStencilNames)
Debug.Print "Active document: " ActiveWindow.Document; " Lower bound:"; intLowerBound; " Upper Bound:"; intUpperBound
intIndex = intLowerBound
While intIndex <= intUpperBound
Debug.Print astrStencilNames(intIndex)
intIndex = intIndex + 1
Wend
End Sub
Applies to | Window object
See Also | Item property | Open method