ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Populate combo box with external data (https://www.excelbanter.com/excel-programming/416855-populate-combo-box-external-data.html)

uwe

Populate combo box with external data
 
Hi,

Help please! I've been trying to find the right code to do the
following but I just can't seem to find the right thing.

OK, I have created a combo box as a user form. The combo box needs to
be populated with several folders found in the same location, let's
say c:\projects

Then the user will have to click on one of those folders which contain
text files. So, I think I will need a subfolder in the combo box which
will display those files and finally the user will click on one of
them.

Is this possible on just one combo box or do I need two combo boxes
linked to each other?

Any help with the code would be greatly appreciated,

joel

Populate combo box with external data
 
See if this helps

Sub Fillcombobox()

Do
fileToOpen = Application _
.GetOpenFilename("Text Files (*.txt), *.txt")
If fileToOpen < False Then
'Open file and
'Load you combobox here
End If
Msg = "Do you want to load Combobox with another file?"
Response = MsgBox(Msg, vbYesNo, "Get Data")
Loop While Response = vbYes

End Sub


"uwe" wrote:

Hi,

Help please! I've been trying to find the right code to do the
following but I just can't seem to find the right thing.

OK, I have created a combo box as a user form. The combo box needs to
be populated with several folders found in the same location, let's
say c:\projects

Then the user will have to click on one of those folders which contain
text files. So, I think I will need a subfolder in the combo box which
will display those files and finally the user will click on one of
them.

Is this possible on just one combo box or do I need two combo boxes
linked to each other?

Any help with the code would be greatly appreciated,


[email protected]

Populate combo box with external data
 
On Sep 11, 1:34*am, Joel wrote:
See if this helps

Sub Fillcombobox()

Do
* *fileToOpen = Application _
* * * .GetOpenFilename("Text Files (*.txt), *.txt")
* *If fileToOpen < False Then
* * * 'Open file and
* * * 'Load you combobox here
* *End If
* *Msg = "Do you want to load Combobox with another file?"
* *Response = MsgBox(Msg, vbYesNo, "Get Data")
Loop While Response = vbYes

End Sub



"uwe" wrote:
Hi,


Help please! I've been trying to find the right code to do the
following but I just can't seem to find the right thing.


OK, I have created a combo box as a user form. The combo box needs to
be populated with several folders found in the same location, let's
say c:\projects


Then the user will have to click on one of those folders which contain
text files. So, I think I will need a subfolder in the combo box which
will display those files and finally the user will click on one of
them.


Is this possible on just one combo box or do I need two combo boxes
linked to each other?


Any help with the code would be greatly appreciated,- Hide quoted text -


- Show quoted text -



I am working with 2 listBoxes now and the files I would like to
populate have the extension .JAE and they are located in C:\Projects.
The first listBox should populate all fileNames with that extension in
that folder. Selecting one of the populated fileNames should start
Marcro1, which I already have and it writes that file into an Excel
workbook. The second listbox should populate the columns B and C, out
of that workbook. Selection of one of the populated values should
start Macro2.
I have already both macros, they are working fine if I start them from
Excel.

Hope you can help.


All times are GMT +1. The time now is 12:26 AM.

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