Consulting

Results 1 to 2 of 2

Thread: Solved: Combo Box list file directory

  1. #1
    VBAX Newbie
    Joined
    May 2007
    Posts
    5
    Location

    Talking Solved: Combo Box list file directory

    Can I make the list in my combo box a file directory? I save all my files in a specific folder and want to make the contents of that folder my list for the combo box. Any thoughts???

  2. #2
    Hi

    Here's something for you. The sub's input argument is the folder you want to list. Form1 and ComboBox1 are form and combobox names that need to be replaced.
    [vba]Sub FileList_to_ComboBox(Fldr as String)
    Dim sTemp As String

    sTemp = Dir(Fldr & "*.*", vbNormal)
    Do
    If sTemp <> "." And sTemp <> ".." Then
    Forms("Form1").Controls("ComboBox1").AddItem sTemp
    End If
    sTemp = Dir()
    Loop Until sTemp = ""
    End Sub
    [/vba]
    Jimmy
    -------------------------------------------------
    The more details you give, the easier it is to understand your question. Don't save the effort, tell us twice rather than not at all. The amount of info you give strongly influences the quality of answer, and also how fast you get it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •