+ Reply to Thread
Results 1 to 15 of 15

Refresh Treeview on UserForm

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

    Refresh Treeview on UserForm

    I have a treeview on userform and when you open no items are selected on tree,once you click a item its highlighted.I want to have a command button
    to set the tree back to the way it opens with no selected item.I can do it by unloading and loading form but must be better way.This code does not work ,not
    sure if a tree can be refresh to open state after a item has been selected. Maybe some ideas

    Please Login or Register  to view this content.

  2. #2
    Forum Expert
    Join Date
    02-14-2009
    Location
    .
    MS-Off Ver
    ................
    Posts
    2,840

    Re: Refresh Treeview on UserForm

    Please Login or Register  to view this content.

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

    Re: Refresh Treeview on UserForm

    Hello cytop
    Gave it a try and no luck,item stays highlighted.

  4. #4
    Forum Expert
    Join Date
    02-14-2009
    Location
    .
    MS-Off Ver
    ................
    Posts
    2,840

    Re: Refresh Treeview on UserForm

    Works for me... Do you have any other code in a NodeClick (or other event that might b fired) for the Treeview?

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

    Re: Refresh Treeview on UserForm

    You are correct cytop
    have some other code to fix,this might take me some time.

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

    Re: Refresh Treeview on UserForm

    Really need expert help,can't find way to take focus off list index when something is typed in search box.I want when
    you type a letter in search box the list index has nothing selected except search results.When you click to clear the
    search box there is no items selected and the textbox is blank like when form opened.
    Attached Files Attached Files

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

    Re: Refresh Treeview on UserForm

    Your are set the DropHighlight property when you select an item this will clear it when you press 'X' on search

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

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

    Re: Refresh Treeview on UserForm

    Thanks Andy

    Is there a way that set the form back to when it opens state when a letter is typed in search box? When you first open form nothing is selected and no text in textbox1. Maybe
    this is not possible.

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

    Re: Refresh Treeview on UserForm

    If you reset the list when you enter text in to the search box how will you know your search found anything?

    To reset the list use a loop and set nodes selected property to false. set the treeviews selected node to nothing and clear the drophilight

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

    Re: Refresh Treeview on UserForm

    I'm little slow Andy but I will get this.LOL
    Can you reset form when you enter searchbox everything is like userform has been loaded for first time.

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

    Re: Refresh Treeview on UserForm

    Yes.
    It you create your own routine with the relevant code in it you can call that. You can even call it from the userforms initialize event.

    you have something similar already, which is the routine PopulateLibs.

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

    Re: Refresh Treeview on UserForm

    Thanks Andy
    After many hours of trying, and searching on google has got me no where.I guess I can stay with unload,load to make it work.Wish the
    userform did not show changes when re loading.

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

    Re: Refresh Treeview on UserForm

    not sure exactly how much the userform should reset but try this additional code in the enter event of the search text box

    Please Login or Register  to view this content.

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

    Re: Refresh Treeview on UserForm

    Hello Andy
    This is getting so close,the only problem is when I enter the search box it deletes the data in the node that was selected. Need to get the textbox to default back to
    stage when the form Initialize. I added label2.caption to the code so it disappears when you enter search box.Have to find a way to clear textbox and not delete data
    from its database.

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

    Re: Refresh Treeview on UserForm

    Hello Andy Again
    This thing is so close,here is a way I found around the problem.I added some code that just hides the data in textbox,seems to
    work but not sure if its the best way. here is what I added.

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.

+ 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. Search box on Userform Treeview
    By zplugger in forum Excel General
    Replies: 21
    Last Post: 01-15-2015, 08:28 AM
  2. [SOLVED] UserForm Treeview
    By zplugger in forum Excel General
    Replies: 8
    Last Post: 01-08-2015, 08:03 AM
  3. [SOLVED] Refresh UserForm after entering data in another userform
    By s2jrchoi in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-30-2013, 10:34 AM
  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