Populate combo box with external data

U

uwe

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,
 
J

Joel

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
 
U

uwegolla

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










- 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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top