PDA

View Full Version : Solved: Combo Box list file directory



rhxiong
05-04-2007, 12:03 PM
Can I make the list in my combo box a file directory? I save all my files in a specific folder and want to make the contents of that folder my list for the combo box. Any thoughts???

JimmyTheHand
05-06-2007, 10:54 PM
Hi :hi:

Here's something for you. The sub's input argument is the folder you want to list. Form1 and ComboBox1 are form and combobox names that need to be replaced.
Sub FileList_to_ComboBox(Fldr as String)
Dim sTemp As String

sTemp = Dir(Fldr & "*.*", vbNormal)
Do
If sTemp <> "." And sTemp <> ".." Then
Forms("Form1").Controls("ComboBox1").AddItem sTemp
End If
sTemp = Dir()
Loop Until sTemp = ""
End Sub

Jimmy