LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Better way to fill a ComboBox ?

Borrowed and "bent" this code to display what I needed but.....This
works for just a few files but has a slight delay..... I suspect as
the files build-up it will slow even more. Is there a better way to add
files from a preset folder (with the filename starting with the days of
the week) into a ComboBox?

Private Sub ComboBox1_DropButtonClick()
Dim myPath As String
Dim lLen As Long, i As Long
Dim DayO As String
Dim Loopy As Integer

Application.ScreenUpdating = False

HomeBook = ThisWorkbook.Name
myPath =
Workbooks(HomeBook).Sheets("Configuration").Range( "ReportExportPath").Value
lLen = Len(myPath) + 1
Workbooks(HomeBook).Sheets("Report").ComboBox1.Cle ar
Workbooks(HomeBook).Sheets("Report").ComboBox1.Tex t = "Select a
previous shift to View"

For Loopy = 1 To 7
If Loopy = 1 Then DayO = "Monday"
If Loopy = 2 Then DayO = "Tuesday"
If Loopy = 3 Then DayO = "Wednesday"
If Loopy = 4 Then DayO = "Thursday"
If Loopy = 5 Then DayO = "Friday"
If Loopy = 6 Then DayO = "Saturday"
If Loopy = 7 Then DayO = "Sunday"

With Application.FileSearch
.NewSearch
.LookIn = myPath
.SearchSubFolders = False
.Filename = DayO & "*.xls"
.FileType = msoFileTypeExcelWorkbooks
If .Execute() 0 Then
For i = 1 To .FoundFiles.Count
ComboBox1.AddItem Left(Right(.FoundFiles(i), Len(.FoundFiles(i)) -
lLen), (Len(Right(.FoundFiles(i), Len(.FoundFiles(i)) - lLen)) - 4))
Next i
End If
End With
Next

End Sub


Any help appreciated

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Fill a Combobox from a ROW? Rob[_5_] Excel Discussion (Misc queries) 4 January 15th 09 08:12 PM
fill combobox depending on selection from another combobox Adam Francis Excel Discussion (Misc queries) 2 July 24th 08 07:39 PM
Fill combobox from DLL JJ[_9_] Excel Programming 0 April 14th 06 10:02 AM
combobox fill problem Pierre via OfficeKB.com[_2_] Excel Programming 1 December 16th 05 08:01 PM
Fill a combobox karibou Excel Programming 2 January 27th 04 04:13 PM


All times are GMT +1. The time now is 01:19 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"