+ Reply to Thread
Results 1 to 7 of 7

Thread: Treeview Control displays items not hierachically

  1. #1
    Registered User
    Join Date
    12-03-2010
    Location
    Bern, Switzerland
    MS-Off Ver
    Excel 2007
    Posts
    4

    Treeview Control displays items not hierachically

    Hi there

    I've added a user control in Excel2007. Within this control is a MS TreeView Control 6.0.
    During the user control intialization, nodes are added to the treeview:

    Me.TreeView_Audituniverse.Nodes.Clear
    
    Me.TreeView_Audituniverse.Nodes.Add Key:="Key1", Text:="Key1"
    Me.TreeView_Audituniverse.Nodes.Add relative:="Key1", relationship:=tvwChild, Key:="Key2", Text:="Key2"
    Me.TreeView_Audituniverse.Nodes.Add relative:="Key2", relationship:=tvwChild, Key:="Key3", Text:="Key3"
    Me.TreeView_Audituniverse.Nodes.Add relative:="Key2", relationship:=tvwChild, Key:="Key4", Text:="Key4"
    I expected to display to be like this:
    Key1
    -Key2
    -Key3
    -Key4
    But when I try it, no hierarchy is displayed and the control looks like:
    Key4
    Key3
    Key2
    Key1

    Does anybody has an idea what I'm missing???

    Thanks, Pi
    Last edited by pi3412; 12-07-2010 at 10:50 AM.

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    2003 & 2007 & 2010
    Posts
    11,351

    Re: Treeview Control displays items not hierachically

    Can you post workbook example as your test code appears to build the tree correctly.

    For me Key1 is the only item displayed. I have to expand the node to see the other items but they are there.
    Cheers
    Andy
    www.andypope.info

  3. #3
    Registered User
    Join Date
    12-03-2010
    Location
    Bern, Switzerland
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Treeview Control displays items not hierachically

    Andy, thank you for your reply!

    Please find attached a workbook with the example from my first mail.
    There is also a screenshot of the TreeView how it appears on my machine.

    Best regards

    Pi
    Attached Images Attached Images
    Attached Files Attached Files

  4. #4
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    2003 & 2007 & 2010
    Posts
    11,351

    Re: Treeview Control displays items not hierachically

    Your file does not have a reference to the library, MSCOMCTL, so there is no definition for the const tvwChild.

    Const tvwChild = 4
    Cheers
    Andy
    www.andypope.info

  5. #5
    Registered User
    Join Date
    12-03-2010
    Location
    Bern, Switzerland
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Treeview Control displays items not hierachically

    Andy

    thank you very much for your kind support, it's so much appreciated!!!
    This was the cause!

    I wish you a beautiful day

    Pi

  6. #6
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    Apparently I can't say
    MS-Off Ver
    Apparently I can't say
    Posts
    8,274

    Re: Treeview Control displays items not hierachically

    If you are satisfied with the solution(s) provided, please mark your thread as Solved.

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save

  7. #7
    Registered User
    Join Date
    12-03-2010
    Location
    Bern, Switzerland
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Treeview Control displays items not hierachically

    Quote Originally Posted by romperstomper View Post
    If you are satisfied with the solution(s) provided, please mark your thread as Solved.
    Thank you for the hint!
    Cheers

    Pi

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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.2.0