+ Reply to Thread
Results 1 to 8 of 8

Setting Excel chart series from vb6

  1. #1
    Jim
    Guest

    Setting Excel chart series from vb6

    hi,
    I currently have a line chart which series is setup in vb6.

    I have a undefined amount of values exporting into excel, so i need to set my
    chart series from vb to account for the undefinded amount of values. I have
    upto 3 series per chart already made awaiting for the vb series data.

    the problem is that excel will only let me alter series 1 and i need it to do
    3, and sometimes excel will give an error saying "unable to set series data".

    this is what i have so far.
    x& = no. of lines of data

    Set xlSheet = xlBook.Worksheets("Temperate Chart")
    xlSheet.ChartObjects(1).Chart.SeriesCollection(1).XValues =
    Worksheets("Data").Range("A10:A" & x&) '"Data!$A$10:$A$" & x&
    'xlSheet.ChartObjects(1).Chart.SeriesCollection(1).Values =
    Worksheets("Data").Range("C10:C" & x&)
    'xlSheet.ChartObjects(1).Chart.SeriesCollection(2).Values =
    Worksheets("Data").Range("G10:G" & x&)
    'xlSheet.ChartObjects(1).Chart.SeriesCollection(3).Values =
    Worksheets("Data").Range("K10:K" & x&)


    Please help.

    --
    BLARRR

  2. #2
    Jim via OfficeKB.com
    Guest

    Re: Setting Excel chart series from vb6

    Anyone

    Jim wrote:
    >hi,
    >I currently have a line chart which series is setup in vb6.
    >
    >I have a undefined amount of values exporting into excel, so i need to set my
    >chart series from vb to account for the undefinded amount of values. I have
    >upto 3 series per chart already made awaiting for the vb series data.
    >
    >the problem is that excel will only let me alter series 1 and i need it to do
    >3, and sometimes excel will give an error saying "unable to set series data".
    >
    >this is what i have so far.
    >x& = no. of lines of data
    >
    > Set xlSheet = xlBook.Worksheets("Temperate Chart")
    > xlSheet.ChartObjects(1).Chart.SeriesCollection(1).XValues =
    >Worksheets("Data").Range("A10:A" & x&) '"Data!$A$10:$A$" & x&
    > 'xlSheet.ChartObjects(1).Chart.SeriesCollection(1).Values =
    >Worksheets("Data").Range("C10:C" & x&)
    > 'xlSheet.ChartObjects(1).Chart.SeriesCollection(2).Values =
    >Worksheets("Data").Range("G10:G" & x&)
    > 'xlSheet.ChartObjects(1).Chart.SeriesCollection(3).Values =
    >Worksheets("Data").Range("K10:K" & x&)
    >
    >Please help.
    >


    --
    BLARRR

    Message posted via OfficeKB.com
    http://www.officekb.com/Uwe/Forums.a...chart/200601/1

  3. #3
    Andy Pope
    Guest

    Re: Setting Excel chart series from vb6

    Hi,

    Do the range references contain data. Empty cells can sometimes cause
    problems when trying to set range references.

    Cheers
    Andy

    Jim via OfficeKB.com wrote:
    > Anyone
    >
    > Jim wrote:
    >
    >>hi,
    >>I currently have a line chart which series is setup in vb6.
    >>
    >>I have a undefined amount of values exporting into excel, so i need to set my
    >>chart series from vb to account for the undefinded amount of values. I have
    >>upto 3 series per chart already made awaiting for the vb series data.
    >>
    >>the problem is that excel will only let me alter series 1 and i need it to do
    >>3, and sometimes excel will give an error saying "unable to set series data".
    >>
    >>this is what i have so far.
    >>x& = no. of lines of data
    >>
    >> Set xlSheet = xlBook.Worksheets("Temperate Chart")
    >> xlSheet.ChartObjects(1).Chart.SeriesCollection(1).XValues =
    >>Worksheets("Data").Range("A10:A" & x&) '"Data!$A$10:$A$" & x&
    >> 'xlSheet.ChartObjects(1).Chart.SeriesCollection(1).Values =
    >>Worksheets("Data").Range("C10:C" & x&)
    >> 'xlSheet.ChartObjects(1).Chart.SeriesCollection(2).Values =
    >>Worksheets("Data").Range("G10:G" & x&)
    >> 'xlSheet.ChartObjects(1).Chart.SeriesCollection(3).Values =
    >>Worksheets("Data").Range("K10:K" & x&)
    >>
    >>Please help.
    >>

    >
    >


    --

    Andy Pope, Microsoft MVP - Excel
    http://www.andypope.info

  4. #4
    Jim via OfficeKB.com
    Guest

    Re: Setting Excel chart series from vb6

    The cells get full up and then i send the series values.

    Andy Pope wrote:
    >Hi,
    >
    >Do the range references contain data. Empty cells can sometimes cause
    >problems when trying to set range references.
    >
    >Cheers
    >Andy
    >
    >> Anyone
    >>

    >[quoted text clipped - 22 lines]
    >>>
    >>>Please help.

    >


    --
    BLARRR

    Message posted via OfficeKB.com
    http://www.officekb.com/Uwe/Forums.a...chart/200601/1

  5. #5
    Andy Pope
    Guest

    Re: Setting Excel chart series from vb6

    Hi,

    In the limited testing I can do the code works for me for all 3 series
    when the cells are filled.
    I could only raise an error if any of the cells in row 10 were either
    completely empty or had the formula =NA(). Numbers and even letters was
    fine.

    Cheers
    Andy

    Jim via OfficeKB.com wrote:
    > The cells get full up and then i send the series values.
    >
    > Andy Pope wrote:
    >
    >>Hi,
    >>
    >>Do the range references contain data. Empty cells can sometimes cause
    >>problems when trying to set range references.
    >>
    >>Cheers
    >>Andy
    >>
    >>
    >>>Anyone
    >>>

    >>
    >>[quoted text clipped - 22 lines]
    >>
    >>>>Please help.

    >>

    >


    --

    Andy Pope, Microsoft MVP - Excel
    http://www.andypope.info

  6. #6
    Jim via OfficeKB.com
    Guest

    Re: Setting Excel chart series from vb6

    thx for the reply, its starting to com on ok now. I just need to find out
    how to count series now.

    Andy Pope wrote:
    >Hi,
    >
    >In the limited testing I can do the code works for me for all 3 series
    >when the cells are filled.
    >I could only raise an error if any of the cells in row 10 were either
    >completely empty or had the formula =NA(). Numbers and even letters was
    >fine.
    >
    >Cheers
    >Andy
    >
    >> The cells get full up and then i send the series values.
    >>

    >[quoted text clipped - 11 lines]
    >>>
    >>>>>Please help.

    >


    --
    BLARRR

    Message posted via OfficeKB.com
    http://www.officekb.com/Uwe/Forums.a...chart/200601/1

  7. #7
    Andy Pope
    Guest

    Re: Setting Excel chart series from vb6

    Glad to hear that.

    Count series as in,

    xlSheet.ChartObjects(1).Chart.SeriesCollection.count

    Cheers
    Andy

    Jim via OfficeKB.com wrote:
    > thx for the reply, its starting to com on ok now. I just need to find out
    > how to count series now.
    >
    > Andy Pope wrote:
    >
    >>Hi,
    >>
    >>In the limited testing I can do the code works for me for all 3 series
    >>when the cells are filled.
    >>I could only raise an error if any of the cells in row 10 were either
    >>completely empty or had the formula =NA(). Numbers and even letters was
    >>fine.
    >>
    >>Cheers
    >>Andy
    >>
    >>
    >>>The cells get full up and then i send the series values.
    >>>

    >>
    >>[quoted text clipped - 11 lines]
    >>
    >>>>>>Please help.

    >>

    >


    --

    Andy Pope, Microsoft MVP - Excel
    http://www.andypope.info

  8. #8
    Jim via OfficeKB.com
    Guest

    Re: Setting Excel chart series from vb6

    Hi. my problem now is that my code does not work when im not on the chart
    page.
    i have 4 pages:
    1 = data page
    2,3,4 = chart pages

    if i run the code while the datapage is selected(viewed) the code will be
    rejected.


    Jim wrote:
    >thx for the reply, its starting to com on ok now. I just need to find out
    >how to count series now.
    >
    >>Hi,
    >>

    >[quoted text clipped - 12 lines]
    >>>>
    >>>>>>Please help.

    >


    --
    BLARRR

    Message posted via OfficeKB.com
    http://www.officekb.com/Uwe/Forums.a...chart/200601/1

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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.6.0 RC 1