combo dropdown box and directories

Is it possible to fill a dropdown combobox with directory folders?  I have a program that creates a set of folders within the app.path and the user needs to select a directory folder.
Daron1Asked:
Who is Participating?
 
philchangConnect With a Mentor Commented:
The following code will add all of the directories in SearchPath (set this to whatever directory you want, such as app.path) into a combo box named Combo1.

Private Sub Form_Load()
Dim CurrentDirectory
Dim SearchPath

SearchPath = "c:\"
CurrentDirectory = Dir(SearchPath, vbDirectory)

Do While CurrentDirectory <> ""
   If CurrentDirectory <> "." And CurrentDirectory <> ".." Then
      If (GetAttr(SearchPath & CurrentDirectory) And vbDirectory) = vbDirectory Then
         Combo1.AddItem CurrentDirectory
      End If
   End If
   CurrentDirectory = Dir
Loop

End Sub

Hope this helps,
Phil
0
 
Daron1Author Commented:
Can't be any better than that.  Thanks a million.

Daron
0
All Courses

From novice to tech pro — start learning today.