Results 1 to 2 of 2

Thread: Treeview in VBA in Excel

  1. #1
    Join Date
    Jan 2012
    Posts
    30

    Treeview in VBA in Excel

    Is there any way to show the list that I have on a spreadsheet on a TreeView Control using Excel VBA. It is nothing but a list of folders taken from somewhere using the shell command and each folder that is put into 1 column of the Excel. I basically want that structure to be shown on a User form with the appropriate structure maintained...thought it may be possible using Treeview? I have never used Treeview earlier, hence I have no idea how to use it, any pointers will be greatly appreciated.

  2. #2
    Join Date
    Jul 2011
    Posts
    634

    Re: Treeview in VBA in Excel

    You just need to know which node is selected and then remove it.
    Code:
    Private Sub TreeView1_KeyDown(KeyCode As Integer, _
    ByVal Shift As Integer)
    
    Dim nodTemp As Node
    
    If KeyCode = vbKeyDelete Then
    Set nodTemp = TreeView1.SelectedItem
    If MsgBox("Are you sure you want to delete " & _
    nodTemp.Text, vbYesNo Or vbQuestion) = vbYes Then
    TreeView1.Nodes.Remove nodTemp.Index
    End If
    End If
    
    End Sub

Similar Threads

  1. Silverlight Treeview examples in VB
    By Sheravat in forum Software Development
    Replies: 5
    Last Post: 06-08-2010, 05:38 AM
  2. How to add an Image to a parent node in a treeview?
    By Casie in forum Software Development
    Replies: 4
    Last Post: 27-01-2010, 05:02 PM
  3. Features of Flexible TreeView
    By michaels in forum Windows Software
    Replies: 5
    Last Post: 22-01-2010, 05:32 AM
  4. Treeview with wpf module as child
    By Wyvern in forum Software Development
    Replies: 5
    Last Post: 11-12-2009, 05:22 PM
  5. How to Highlight TreeView.SelectedNode in VB.Net
    By Pratyush in forum Software Development
    Replies: 3
    Last Post: 03-03-2009, 03:10 PM

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
  •  
Page generated in 1,713,908,632.02162 seconds with 17 queries