I'm building a VSTO project with a simple action pane containing a treeview. Coming from VBA, things are similar, but not the same and I'm a bit confused.
What I want to do is load all sheets to the tree view, and give each node the color of the respective sheet. I'm getting an error at the commented line below, I believe the error is coming from the fact that the N.BackColor is in RGB and SH.Tab.Color is in colorcode.
The question is should I use a different property to get the same color type, or do I need to cast it. If I need to cast it please help me with this, as most of the documentation is in C#, and I'm not sure where to look for an answer
Private Sub ActionPane_SheetSearch_Load(sender As Object, e As EventArgs) Handles Me.Load
Dim SH As Excel.Worksheet, N As TreeNode
With Me
.Width = 200
End With
With Me.TreeView1
.ItemHeight = 20
For Each SH In Globals.ThisWorkbook.Sheets
N = .Nodes.Add(SH.Name)
N.Tag = SH.CodeName
'N.BackColor = SH.Tab.Color
Next
End With
End Sub
Also with .Width = 200
i'm trying to customize the with of the action pane, but it's ignoring the code or I'm not doing it correclty.
I tried setting the starting width at the begining as well, it does not respond.
Please let me know how can I set the starting with, and also set the default position to left instead of right.
Private Sub ThisWorkbook_Startup() Handles Me.Startup
Globals.ThisWorkbook.ActionsPane.Controls.Add(taskPane)
Globals.ThisWorkbook.Application.DisplayDocumentActionTaskPane = True
taskPane.Width = 400
taskPane.Show()
End Sub