Share via


Application.EnumDirectories Method

Visio Automation Reference

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

Version Information
 Version Added:  Visio 4.5

Syntax

expression.EnumDirectories(PathsString, NameArray())

expression   A variable that represents an Application object.

Parameters

Name Required/Optional Data Type Description
PathsString Required String A string of full or partial paths separated by semicolons.
NameArray() Required String Out parameter. An array that receives the enumerated folder names.

Return Value
Nothing

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() parameter is an out parameter 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.

Visual Basic for Applications
  
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

See Also