Results 1 to 3 of 3
  1. #1
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: vba (vb basic)

    Dim strPath As String
    Dim strFile As String

    strPath = "C:NewFolder"
    strFile = Dir(strFile & Me.TextBox1 & "*.*")
    Do While Not strFile = ""
    Me.ListBox1.AddItem strFile
    strFile = Dir
    Loop

    where TextBox1 is the text box containing the initial characters to search for, and ListBox1 is the list box.

  2. #2
    2 Star Lounger
    Join Date
    Apr 2004
    Posts
    129
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Fill list box with file names (vb basic)

    subject edited by HansV because "vba" is not very informative as a subject in the VBA forum

    how do you perform a search for variable file names? say that my files are on the C:newfolder

    and the names are 1234, 12345, 123456, 1244, 1244-dig, 167

    if I only want my listbox to show what I put in my textbox (ie .... lets say i'm looking for all files that only start with 1244) how would I code that in Visual basic.

  3. #3
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Fill list box with file names (vb basic)

    By the way, you asked basically the same in <post:=540,110>post 540,110</post:>. Did you have a particular reason for asking again?

Posting Permissions

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