Results 1 to 14 of 14

Thread: Search files from textbox in UserForm, display result in Listbox

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #12
    Administrator VBAX Master georgiboy's Avatar
    Joined
    Mar 2008
    Location
    Kent, England
    Posts
    1,302
    Location
    If you look inside the 'Search' button code on the userform you will find a line of code:
    Me.ListBox1.List = PDFvarName
    You can swap that for the below:
    If Len(Join(PDFvarName)) > 0 Then        
         Me.ListBox1.List = PDFvarName
         ListBox1.Enabled = True
         ListBox1.ForeColor = vbBlack
    Else
         Me.ListBox1.List = Array("Not Found")
         ListBox1.Enabled = False
         ListBox1.ForeColor = RGB(128, 128, 128)
    End If
    You will also find line:
    Me.ListBox2.List = DXFvarName
    You can swap that for the below:
    If Len(Join(DXFvarName)) > 0 Then    
        Me.ListBox2.List = DXFvarName
        ListBox2.Enabled = True
        ListBox2.ForeColor = vbBlack
    Else
        Me.ListBox2.List = Array("Not Found")
        ListBox2.Enabled = False
        ListBox2.ForeColor = RGB(128, 128, 128)
    End If
    Hope this helps
    Last edited by georgiboy; 01-10-2022 at 07:47 AM.
    Click here for a guide on how to add code tags
    Click here for a guide on how to mark a thread as solved
    Click here for a guide on how to upload a file with your post

    Excel 365, Version 2408, Build 17928.20080

Posting Permissions

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