Archive of Mr Excel Message Board

Back to Controls in Excel archive index
Back to archive home

combobox with file names
Posted by John on August 08, 2001 1:31 PM
Hey folks-
I am trying to mimic the basic functionality of excel's "open" menu on my own.
I have a combobox which I would like to populate with all the excel files in a particular directory, but I don't know the code to do this. Any suggestions?
Thanks in advance

Re: combobox with file names
Posted by Ivan F Moala on August 08, 2001 8:17 PM
Place code such as this in the userform ??
assuming you are using a userform ....initialize
routine.
Dim F
Dim x
F = Dir("C:\Excelfiles\Useful\*.xls")
ComboBox1.Clear
Do While Len(F) > 0
ComboBox1.AddItem F
F = Dir()
x = x + 1
Loop

This archive is from the original message board at www.MrExcel.com.
All contents © 1998-2004 MrExcel.com.
Visit our
online store to buy searchable CD's with thousands of VBA and Excel answers.
Microsoft Excel is a registered trademark of the Microsoft Corporation.
MrExcel is a registered trademark of Tickling Keys, Inc.