Sub GetStyleTypes()
Dim Dirlen As Integer
Dim f, f1, fc, s
Dim iFileCount As Integer
Dim strTemp As String
iFileCount = 0
GetDirectory
' Set fs = Application.FileSearch
' With fs
' .LookIn = Directory
' .FileType = msoFileTypeExcelWorkbooks
' If .Execute > 0 Then
' iFileCount = .FoundFiles.Count
' For i = 1 To iFileCount
' Dirlen = Len(.LookIn) + 2
' strTemp = Mid(.FoundFiles(i), Dirlen)
' StyleBox.AddItem (strTemp)
' Next i
' End If
' End With
' If iFileCount = 0 Then
' Set fs = Nothing
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFolder(Directory)
Set fc = f.Files
For Each f1 In fc
If UCase(Right((f1.Name), 4)) = ".XLS" Then
iFileCount = iFileCount + 1
Dirlen = Len(Directory) + 2
strTemp = f1.Name
StyleBox.AddItem (strTemp)
End If
Next
' End If
cleanup:
Set fs = Nothing
Set f = Nothing
Set fc = Nothing
End Sub