Article ID: 121890
Article Last Modified on 1/19/2007
120802 Office: How to Add/Remove a Single Office Program or Component
Sub MAIN
FileNewDefault
num = CountDirectories()
For i = 1 To num
Insert GetDirectory$(i)
InsertPara
Next i
End Sub
The following example macro determines how many directories stem from the
current directory and defines an array named SubDirs$() to hold the
directory names:
Sub MAIN
REM Define an array for the directory names
Dim subdirs$(CountDirectories())
subdirs$(0) = "[..]"
For i = 1 To CountDirectories()
subdirs$(i) = LCase$(GetDirectory$(i))
Next
REM Sort the array of directories and display them in a list box.
SortArray subdirs$()
Begin Dialog UserDialog 396, 154, "Directories Available"
OKButton 254, 88, 88, 21
CancelButton 254, 113, 88, 21
ListBox 18, 21, 215, 114, subdirs$(), .ListBox1
End Dialog
Dim dlg As UserDialog
n = Dialog(dlg)
End Sub
NOTE: The disk that accompanies the Word Developer's Kit includes a macro
that allows you to browse through files in any directory. The macro uses a
dynamic dialog box to display a file and directory list similar to the Open
dialog box in Word. The macro is named ch05ex06FileBrowser and is located
in the Examples.dot file.
Additional query words: GetDirectory$() Array Subdirectory CountDirectories
Keywords: kbhowto kbinfo kbmacro kbmacroexample KB121890