I hate to keep posting Excel questions but I have another question. I'm trying to open an Excel template that contains two worksheets and one or more charts. I want to be able to take the charts and load the chart name and variables in a treeview. I can get the chart names into the parent nodes but I'm having trouble getting the Variables associated to each chart. I've tried using the seriescollection but something just isn't right.
I guess my question is how can I determine the variables in an Excel charts series?
Below is what I have. The "var =" line is where my troubles begin.
vb Code:
Public Function GetCharts() As TreeNode Dim parentNode As TreeNode = Nothing Dim var As String = "" Dim i as Integer = 1 For Each oCht As Excel.Chart In oExcel.Workbooks(1).Charts parentNode = New TreeNode(oCht.Name) Do var = CType(oCht.SeriesCollection, Excel.SeriesCollection).Item(i).Name i += 1 parentNode.Nodes.Add(var) Loop While var <> "" Next Return parentNode End Function




Reply With Quote