ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   populate a combobox with filenames in a specific folder (https://www.excelbanter.com/excel-programming/450979-populate-combobox-filenames-specific-folder.html)

Roady Mayhem

populate a combobox with filenames in a specific folder
 
Hi all,

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

I have tried several suggestions from the internet, but so far nothing has worked.

Many thanks in advance,

Sybolt

Claus Busch

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


All times are GMT +1. The time now is 08:22 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com