+ Reply to Thread
Results 1 to 22 of 22

Search box on Userform Treeview

  1. #1
    Forum Contributor
    Join Date
    03-05-2009
    Location
    usa
    MS-Off Ver
    Excel 2016 32Bit
    Posts
    1,170

    Search box on Userform Treeview

    Is it possible to search a treeview list and have it fill in the textbox?. If so the search would include Parent and Child nodes.
    Can it show all words that match? say there is a word called color,it would select them all ?


    I apologize for not coming back and editing this post to show Cross-Post on the question. Hope this did not
    waste any persons time on helping people on the forum.
    http://www.ozgrid.com/forum/showthread.php?t=192594
    Attached Files Attached Files
    Last edited by zplugger; 01-13-2015 at 03:44 PM.

  2. #2
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Search box on Userform Treeview

    Right now your code will only work on 32 bit installations of Excel. Anyone running 64 bit will not be able to run the macros. To fix the 64 bit problem, the solution is found here: http://stackoverflow.com/questions/1...ng-with-64-bit
    <---------If you like someone's answer, click the star to the left of one of their posts to give them a reputation point for that answer.
    Ron W

  3. #3
    Forum Contributor
    Join Date
    03-05-2009
    Location
    usa
    MS-Off Ver
    Excel 2016 32Bit
    Posts
    1,170

    Re: Search box on Userform Treeview

    Thanks newdoverman
    Do you think the search box is possible

  4. #4
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Search box on Userform Treeview

    VBA is very powerful and I will not rule out the possibility of a VBA expert devising a way to do what you want. I am not conversant in VBA (even though I did find the above about 32 to 64 bit conversions) and I haven't seen what your macro does.

    I do advise you to be very specific in what you want even to the point of mocking up what you envision the starting data to be and what the end result should be. Give a description of the whole requirement and not a bit at a time as this will yield much better results.

    Good luck.

  5. #5
    Forum Contributor
    Join Date
    03-05-2009
    Location
    usa
    MS-Off Ver
    Excel 2016 32Bit
    Posts
    1,170

    Re: Search box on Userform Treeview

    Thanks Again
    I'm too not good at VBA, but know there is a lot of smart coders here.Great site for question answered and code help. What I'm looking
    for is a search box on the userform to search the TreeView list and fill the textbox with the item.My example shows different nodes in the
    tree.Was hoping the search will look at all nodes for a match.So as soon as you type in a letter it will begin the search, narrow down with more letters be typed in search box.Not even sure if this is possible?.

  6. #6
    Forum Contributor
    Join Date
    03-05-2009
    Location
    usa
    MS-Off Ver
    Excel 2016 32Bit
    Posts
    1,170

    Re: Search box on Userform Treeview

    If anyone finds time tonight I would appreciate some help on this. I think this
    could be a good tool for people using everyday.I use it as add-in for ideas and code I
    get from the forum. Still not sure its possible?

  7. #7
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,099

    Re: Search box on Userform Treeview

    Hi, zplugger,

    Your post does not comply with Rule 8 of our Forum RULES. Do not crosspost your question on multiple forums without including links here to the other threads on other forums.

    Cross-posting is when you post the same question in other forums on the web. The last thing you want to do is waste people's time working on an issue you have already resolved elsewhere. We prefer that you not cross-post at all, but if you do (and it's unlikely to go unnoticed), you MUST provide a link (copy the url from the address bar in your browser) to the cross-post.

    Expect cross-posted questions without a link to be closed and a message will be posted by the moderator explaining why. We are here to help so help us to help you!

    Read this to understand why we ask you to do this, and then please edit your first post to include links to any and all cross-posts in any other forums (not just this site).

    http://www.ozgrid.com/forum/showthread.php?t=192594

    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  8. #8
    Forum Contributor
    Join Date
    03-05-2009
    Location
    usa
    MS-Off Ver
    Excel 2016 32Bit
    Posts
    1,170

    Re: Search box on Userform Treeview

    I apologize for not coming back and editing this post to show Cross-Post on the question. Hope this did not
    waste any persons time on helping people on the forum.
    http://www.ozgrid.com/forum/showthread.php?t=192594

  9. #9
    Forum Contributor
    Join Date
    03-05-2009
    Location
    usa
    MS-Off Ver
    Excel 2016 32Bit
    Posts
    1,170

    Re: Search box on Userform Treeview

    Is it possible to expand this code to show all words that are the same in treeview? Had help with this but don't know how to make it show all words if possible.

    Please Login or Register  to view this content.

  10. #10
    Forum Contributor
    Join Date
    03-05-2009
    Location
    usa
    MS-Off Ver
    Excel 2016 32Bit
    Posts
    1,170

    Re: Search box on Userform Treeview

    Here is where I'm at now with all updates,lot of views but no inputs. Having problem with search if the search word is in couple nodes,no luck on
    finding a way to make it show all.Can't find a way to return to top node after search box is cleared,I can do it by unloading and loading userform but
    not sure if that is proper. I welcome any new ideas to this form.
    Attached Files Attached Files

  11. #11
    Forum Contributor
    Join Date
    03-05-2009
    Location
    usa
    MS-Off Ver
    Excel 2016 32Bit
    Posts
    1,170

    Re: Search box on Userform Treeview

    Does anyone think the code in thread #9 be changed to read and show all words in the tree with the search. So if doors is typed
    in searchbox it will show all doors?.

  12. #12
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,102

    Re: Search box on Userform Treeview

    Please Login or Register  to view this content.
    Cheers
    Andy
    www.andypope.info

  13. #13
    Forum Contributor
    Join Date
    03-05-2009
    Location
    usa
    MS-Off Ver
    Excel 2016 32Bit
    Posts
    1,170

    Re: Search box on Userform Treeview

    Thanks Andy
    Not sure why but if I type in doors in search box all is well,if I type in roof the whole list turns red?.Is it possible to return back to default node
    when I clear the search box? When I clear now item from search stay red,just noticed if I type in shovel all items red. Some words work perfect others
    will select all items. Maybe you can take look when you get time.Open to all suggestions on this search thing & improvements to form.

    Z

  14. #14
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,102

    Re: Search box on Userform Treeview

    Try the attached.

    I moved the search code into it's own routine. You can call it from the keyup event or the delete search button
    Attached Files Attached Files

  15. #15
    Forum Contributor
    Join Date
    03-05-2009
    Location
    usa
    MS-Off Ver
    Excel 2016 32Bit
    Posts
    1,170

    Re: Search box on Userform Treeview

    Not sure why Andy, but I my end if I type in shovel the whole list is red. Can't open form from commandbutton on first sheet now. Will play around
    with it.

  16. #16
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,102

    Re: Search box on Userform Treeview

    because the variables holding back and fore colours was updated after each search and blank node text was like what ever was being searched for,
    this meant first item was made red. then when it tried to clear selection it actually set it to highlight colours.

    latest version handles shovel correctly
    Attached Files Attached Files

  17. #17
    Forum Contributor
    Join Date
    03-05-2009
    Location
    usa
    MS-Off Ver
    Excel 2016 32Bit
    Posts
    1,170

    Re: Search box on Userform Treeview

    Thanks again Andy,people of this forum are lucky to have people like you spread your knowledge.Going to study code
    to understand how it works,again Thank You for your time on this.
    Z

  18. #18
    Forum Contributor
    Join Date
    03-05-2009
    Location
    usa
    MS-Off Ver
    Excel 2016 32Bit
    Posts
    1,170

    Re: Search box on Userform Treeview

    Hello All
    Project almost done,just found a couple things to change. When you do a search it expands the tree to all search words like it should.Would like it to close the the expanded tree after
    search box is cleared if possible.Would it be possible to clear any selected item on the tree when something is typed in search box. So after you clear the searchbox it would look like the form
    was just opened with nothing selected.

  19. #19
    Forum Contributor
    Join Date
    03-05-2009
    Location
    usa
    MS-Off Ver
    Excel 2016 32Bit
    Posts
    1,170

    Re: Search box on Userform Treeview

    Boy do I really have respect for the coders on this forum,some of this stuff is hard.I just spend hours trying
    to understand what going on with different codes.Learn a lot on how it works,but I just cant figure out how the Treeview list index
    start in neutral state when form is opened.I see where it stores the keys in cell Z1 on correct lib sheet,but what tell it to start the list index
    with no items selected.I want to code the delete button to clear textbox8 and return the listbox like startup.I hoping to add the part that sets list index
    to textbox8 change so no items are selected are selected when you type in listbox. I can get the tree to collapse after a search(might be wrong buts works).If
    I can find why the list index is highlighted to nothing on open I think I can move on.

  20. #20
    Forum Contributor
    Join Date
    03-05-2009
    Location
    usa
    MS-Off Ver
    Excel 2016 32Bit
    Posts
    1,170

    Re: Search box on Userform Treeview

    Any idea's if if possible to reset the list index without unloading the form?

  21. #21
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,102

    Re: Search box on Userform Treeview

    This will collapse the tree

    Please Login or Register  to view this content.
    called from search delete button
    Please Login or Register  to view this content.

  22. #22
    Forum Contributor
    Join Date
    03-05-2009
    Location
    usa
    MS-Off Ver
    Excel 2016 32Bit
    Posts
    1,170

    Re: Search box on Userform Treeview

    Thanks Andy
    Works like a charm,almost time to close this thread. Over 350 views was hoping for some other ideas,maybe a problem with 64 bit office machines.I know you have
    to have treeview on your machine to make it work.I know newdoverman said issue with 64 bit office,I'm running 32 bit so not sure how to fix.Still would like to make improvements to workbook
    but limited on what I can figure out.
    1- Not sure if possible but if you select a item in the tree for example shovel,then type door in search box all doors are red but shovel still highlighted.Wonder if there is a way to on select any
    item(undo) when you type in search box?
    2- There is no way to delete a library page,if you add a library page called tools it will create it but no way to delete it.Another thing is when you make a new lib page you have to add a root to that
    page before you close it or the workbook will not open. (Something about list index out of bounds).

    This is all I can find,new ideas are welcome from everyone.
    Z

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] UserForm Treeview
    By zplugger in forum Excel General
    Replies: 8
    Last Post: 01-08-2015, 08:03 AM
  2. Userform Search Function Autofilter Results and Repopulate Userform
    By cindy71 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-16-2012, 03:46 PM
  3. UserForm to search sheet, show results on separate userform?
    By egemenkepekci in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-25-2010, 01:06 PM
  4. How to use a Treeview control in a UserForm
    By rich534714 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-19-2007, 10:46 AM
  5. [SOLVED] Embed Folder Treeview Or Windows Explorer On UserForm
    By MDW in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-27-2006, 11:55 AM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1