FYI
comboboxlist1 = combobox
This does a recursive search for files in your sInitDir (initial directory)
Sorry...no comments, as I am lacked for time.
Play with it to see how it works. Its simple enough.
Happy Black History Month!
Private Sub LogFilesOfType(ByVal sType As String, Optional ByVal sInitDir
As String = "C:\")
Dim sSubFolder() As String
Dim iSubFolder As Long
Dim sDir As String
Dim bLogged As Boolean
On Error Resume Next
If Right$(sType, 1) <> "," Then sType = sType & ","
If Right$(sInitDir, 1) <> "\" Then sInitDir = sInitDir & "\"
sDir = Dir(sInitDir & "*", vbArchive + vbHidden + vbNormal +
vbReadOnly + vbSystem + vbDirectory)
While Len(sDir)
If (GetAttr(sInitDir & sDir) And vbDirectory) = vbDirectory Then
If Left(sDir, 1) <> "." Then
ReDim Preserve sSubFolder(iSubFolder)
sSubFolder(iSubFolder) = sDir
iSubFolder = iSubFolder + 1
End If
ElseIf InStr(sDir, ".") Then
If InStr(sType, Mid$(sDir, InStr(sDir, ".")) & ",") Then
comboboxlist1.AddItem sInitDir & sDir
End If
End If
sDir = Dir
Wend
If iSubFolder Then
For iSubFolder = 0 To UBound(sSubFolder)
Call LogFilesOfType(sType, sInitDir & sSubFolder(iSubFolder))
Next
End If
End Sub
> Dear all,
Can anyone tell me what would be the best way to do the following:
I want to get a list of file names load into the combo box
i.e.: c:\TimeZone1.txt
c:\TimeZone2.txt
c:\TimeZone3.txt
***Number of files will be vary
Thanks,
Jason