Results 1 to 9 of 9

Thread: [RESOLVED] [2005] Determine variables in Excel Chart

Hybrid View

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2005
    Posts
    394

    Re: [2005] Determine variables in Excel Chart

    After thinking about what is avaiable to a chart, I've realized the the variables do not exist directly. I need to access the range of the series then I can go to the worksheet that contains the series data and extract the variable names.

    This brings me back to the seriecollection method of the chart object. Does anyone know how to use this to get the range of the Y axis values?

  2. #2

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2005
    Posts
    394

    Re: [2005] Determine variables in Excel Chart

    I think that I'm getting close. I can get the number of variables per chart using the code below but when I try to run I get an exception when I cast the seriesCollection.item to a string.


    vb Code:
    1. Public Function GetCharts() As TreeNode
    2.         Dim parentNode As TreeNode = Nothing
    3.  
    4.         Try
    5.  
    6.             For Each oCht As Excel.Chart In oExcel.Workbooks(1).Charts
    7.                 Dim var As String
    8.  
    9.                 parentNode = New TreeNode(oCht.Name)
    10.  
    11.                 Dim cnt As Integer = CType(oCht.SeriesCollection, Excel.SeriesCollection).Count
    12.                 For i As Integer = 1 To cnt
    13.                     var = CStr(CType(oCht.SeriesCollection, Excel.SeriesCollection).Item(i))
    14.                     parentNode.Nodes.Add(var)
    15.                 Next
    16.             Next
    17.  
    18.         Catch ex As Exception
    19.             MessageBox.Show("GetCharts.GetVariables: " & ex.Message.ToString)
    20.         End Try
    21.  
    22.         Return parentNode
    23.  
    24.     End Function
    Attached Images Attached Images  

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2005
    Posts
    394

    Re: [2005] Determine variables in Excel Chart

    bump

    I'm finally at a point that this is holding up progress. Any Excel/.Net experts out there that want to give this a go?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width