View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Claus Busch Claus Busch is offline
external usenet poster
 
Posts: 3,872
Default populate a combobox with filenames in a specific folder

Hi,

Am Wed, 8 Jul 2015 05:37:50 -0700 (PDT) schrieb Roady Mayhem:

I'm trying to populate a combobox with the filenames I have saved to a specific folder. This folder only has excel files.


for an ActiveX combobox into the sheet:

Sub Test()
Dim objFSO As Object
Dim objOrdner As Object
Dim objDatei As Object
Dim i As Integer

'Modify your path
Const myPath = "E:\Excel_NG\Aktuell"

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objOrdner = objFSO.GetFolder(myPath)

With ActiveSheet.ComboBox1
For Each objDatei In objOrdner.Files
.AddItem objDatei.Name
Next
End With
End Sub


Regards
Claus B.
--
Vista Ultimate / Windows7
Office 2007 Ultimate / 2010 Professional