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. #1
    VBAX Regular
    Joined
    Dec 2021
    Posts
    42
    Location

    Search files from textbox in UserForm, display result in Listbox

    Hi there,

    I've been searching high and low, but haven't found what i'm looking for yet.

    Its actually pretty simpel (i guess).

    First step:

    Textbox1, Conmandbutton1, listbox1 and listbox2 is shown in userform1.

    (example-)value 22444 is typed in TextBox1
    CmdBotton1 is then pressed
    Result in ListBox1 (only PDF files, location H:\pdf)
    Result in Listbox2 (only DXF files, location H:\dxf)

    but,
    • the found files would/could look like this: 22444_1.pdf, 22444_2.pdf, 22444_A.pdf, 22444_B etc.
    • subfolders might occure and the result from those should be present in the listboxes too


    If the searchstring = 22444 the file will ALWAYS be stored in H:\pdf\20
    So, to make the searching faster i've written the search path like this:
    mypathPDF = "H:\pdf\" & Left(textbox1.value, 1) & "0\" (it should result in a path = H:\pdf\20\)
    mypathDXF = "H:\dxf\" & Left(textbox1.value, 1) & "0\" (it should result in a path = H:\dxf\20\)
    Shoud the searching be seperated into 2 sessions? like by performing the pdf-file search first and then the DXF afterwards?

    Can anybody help me in moving forward? (and type me some code)


    Second step; is to be able to select one item in each listbox and and press a copy-button (comandbutton2). afterwards you switch to an email and press Ctrl+V to insert the copied objects into the mail.
    (don't know if that's possible at all?)

    Thanks
    /c
    Last edited by c_skytte; 12-08-2021 at 05:54 AM.

Posting Permissions

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