Share via


EnumDirectories Method [Visio 2003 SDK Documentation]

Returns an array naming the folders Microsoft Office Visio would search, given a list of paths.

object**.EnumDirectories**PathsString, NameArray

object     Required. An expression that returns an Application object.

PathsString     Required String. A string of full or partial paths separated by semicolons.

NameArray     Required String. Array that receives the enumerated folder names.

Version added

4.5

Remarks

Several Visio properties such as AddonPaths and TemplatePaths accept and receive a string interpreted to be a list of path (folder) names separated by semicolons. When the application looks for items in the named paths, it looks in the folders and all their subfolders.

The purpose of the EnumDirectories method is to accept a string such as one that the AddonPaths property might produce and return a list of the folders that the application enumerates when processing such a string.

If the EnumDirectories method succeeds, NameArray returns a one-dimensional array of n strings indexed from 0 to n - 1. Each string is the fully qualified name of a folder that exists. The list names those folders designated in the path list that exist and all their subfolders.

The NameArray argument is an out argument that is allocated by the EnumDirectories method, and ownership is passed back to the caller. The caller should eventually perform the SafeArrayDestroy procedure on the returned array. (Microsoft Visual Basic and Visual Basic for Applications automatically free the strings referenced by the array's entries.)

Example

The following example shows how to use the EnumDirectories method to print (in the Immediate window) a list of all the folders Visio searches for add-ons.

Public Sub EnumDirectories_Example()
 
    Dim strDirectoryNames() As String
    Dim intLowerBound As Integer 
    Dim intUpperBound As Integer 

    Application.EnumDirectories Application.AddonPaths, strDirectoryNames 
    
    intLowerBound = LBound(strDirectoryNames) 
    intUpperBound = UBound(strDirectoryNames) 

    While intLowerBound <= intUpperBound 
        Debug.Print strDirectoryNames(intLowerBound) 
        intLowerBound = intLowerBound + 1 
    Wend

End Sub

Applies to | Application object | InvisibleApp object

See Also | AddonPaths property | DrawingPaths property | HelpPaths property | Path property | StartupPaths property | StencilPaths property | TemplatePaths property