Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.charting
|
|||
|
|||
![]()
I'm trying to create a XYScatter graph of 3 independent datasets from
within VB6 using OLE/Excel2000. I'm using the KB147803 article as a basis, but am stuck and hope someone can help. The example in KB147803 seems to indicate that there can only be one set of X-Values for the 3 XY Scatter Graph data sets. The X-Value series is the first row of data in the sheet, and is called out as a set of Category labels ('cwCategoryLabels=1'), and applies to all three subsequent rows of Y-Value data. In my case, I want to plot 3 independent sets of XY data, so I'd like to provide a separate row of X-Value data for each row of Y-Value data. I'm not seeing how I can pass this sort of a dataset to objChartChartWizard...is there a way? Thanks very much for any help! Michael |
#2
![]()
Posted to microsoft.public.excel.charting
|
|||
|
|||
![]()
Michael -
Visit this page: http://peltiertech.com/Excel/ChartsH...kChartVBA.html Pay attention to the sections on adding series: Sub AddNewSeries() With ActiveChart.SeriesCollection.NewSeries .Name = ActiveSheet.Range("G3") .Values = ActiveSheet.Range("G4:G14") .XValues = ActiveSheet.Range("A4:A14") End With End Sub - Jon ------- Jon Peltier, Microsoft Excel MVP Tutorials and Custom Solutions Peltier Technical Services, Inc. - http://PeltierTech.com _______ "mb" wrote in message ... I'm trying to create a XYScatter graph of 3 independent datasets from within VB6 using OLE/Excel2000. I'm using the KB147803 article as a basis, but am stuck and hope someone can help. The example in KB147803 seems to indicate that there can only be one set of X-Values for the 3 XY Scatter Graph data sets. The X-Value series is the first row of data in the sheet, and is called out as a set of Category labels ('cwCategoryLabels=1'), and applies to all three subsequent rows of Y-Value data. In my case, I want to plot 3 independent sets of XY data, so I'd like to provide a separate row of X-Value data for each row of Y-Value data. I'm not seeing how I can pass this sort of a dataset to objChartChartWizard...is there a way? Thanks very much for any help! Michael |
#4
![]()
Posted to microsoft.public.excel.charting
|
|||
|
|||
![]()
The code is nearly the same. The difference is that you have to qualify the
code in VB6 a bit more formally. For instance, you need a variable pointing to the working instance of Excel. Supposing the variable is xlApp, then the code I posted looks like this: With xlApp.ActiveChart.SeriesCollection.NewSeries .Name = ActiveSheet.Range("G3") .Values = ActiveSheet.Range("G4:G14") .XValues = ActiveSheet.Range("A4:A14") End With - Jon ------- Jon Peltier, Microsoft Excel MVP Tutorials and Custom Solutions Peltier Technical Services, Inc. - http://PeltierTech.com _______ "mb" wrote in message ... Jon, Thanks for the quick reply! The example code you posted appears to be VBA: do you know if you can do the same thing from within a Visual Basic 6 application? I'm currently using Excel 2000 and can update it if necessary, but I"m pretty stuck with VB6. Buying a VB6 add-on to enable this would be a viable alternative. thanks again, Michael In article , says... Michael - Visit this page: http://peltiertech.com/Excel/ChartsH...kChartVBA.html Pay attention to the sections on adding series: Sub AddNewSeries() With ActiveChart.SeriesCollection.NewSeries .Name = ActiveSheet.Range("G3") .Values = ActiveSheet.Range("G4:G14") .XValues = ActiveSheet.Range("A4:A14") End With End Sub - Jon ------- Jon Peltier, Microsoft Excel MVP Tutorials and Custom Solutions Peltier Technical Services, Inc. - http://PeltierTech.com _______ "mb" wrote in message . .. I'm trying to create a XYScatter graph of 3 independent datasets from within VB6 using OLE/Excel2000. I'm using the KB147803 article as a basis, but am stuck and hope someone can help. The example in KB147803 seems to indicate that there can only be one set of X-Values for the 3 XY Scatter Graph data sets. The X-Value series is the first row of data in the sheet, and is called out as a set of Category labels ('cwCategoryLabels=1'), and applies to all three subsequent rows of Y-Value data. In my case, I want to plot 3 independent sets of XY data, so I'd like to provide a separate row of X-Value data for each row of Y-Value data. I'm not seeing how I can pass this sort of a dataset to objChartChartWizard...is there a way? Thanks very much for any help! Michael |
#5
![]()
Posted to microsoft.public.excel.charting
|
|||
|
|||
![]()
Here's a snippet of my code:
OLE1.CreateEmbed "", "Excel.Chart.5" Set objChart = OLE1.object.ActiveChart Set objSheet = objChart.Parent.Worksheets(1) Set objXL = objChart.Application I tried substituting both "OLE1.object.Application" and "objXL" for xlApp in your example: With objXL.ActiveChart.SeriesCollection.NewSeries .Name = ActiveSheet.Range("G3") .Values = ActiveSheet.Range("G4:G14") .XValues = ActiveSheet.Range("A4:A14") End With But I get the error: <Object variable or With block variable not set A watch on objXL shows it equal to "Microsoft Excel", but the ".ActiveChart" provokes the error. Any thoughts? thanks, Michael In article , says... The code is nearly the same. The difference is that you have to qualify the code in VB6 a bit more formally. For instance, you need a variable pointing to the working instance of Excel. Supposing the variable is xlApp, then the code I posted looks like this: With xlApp.ActiveChart.SeriesCollection.NewSeries .Name = ActiveSheet.Range("G3") .Values = ActiveSheet.Range("G4:G14") .XValues = ActiveSheet.Range("A4:A14") End With - Jon ------- Jon Peltier, Microsoft Excel MVP Tutorials and Custom Solutions Peltier Technical Services, Inc. - http://PeltierTech.com _______ "mb" wrote in message .. . Jon, Thanks for the quick reply! The example code you posted appears to be VBA: do you know if you can do the same thing from within a Visual Basic 6 application? I'm currently using Excel 2000 and can update it if necessary, but I"m pretty stuck with VB6. Buying a VB6 add-on to enable this would be a viable alternative. thanks again, Michael In article , says... Michael - Visit this page: http://peltiertech.com/Excel/ChartsH...kChartVBA.html Pay attention to the sections on adding series: Sub AddNewSeries() With ActiveChart.SeriesCollection.NewSeries .Name = ActiveSheet.Range("G3") .Values = ActiveSheet.Range("G4:G14") .XValues = ActiveSheet.Range("A4:A14") End With End Sub - Jon ------- Jon Peltier, Microsoft Excel MVP Tutorials and Custom Solutions Peltier Technical Services, Inc. - http://PeltierTech.com _______ "mb" wrote in message .. . I'm trying to create a XYScatter graph of 3 independent datasets from within VB6 using OLE/Excel2000. I'm using the KB147803 article as a basis, but am stuck and hope someone can help. The example in KB147803 seems to indicate that there can only be one set of X-Values for the 3 XY Scatter Graph data sets. The X-Value series is the first row of data in the sheet, and is called out as a set of Category labels ('cwCategoryLabels=1'), and applies to all three subsequent rows of Y-Value data. In my case, I want to plot 3 independent sets of XY data, so I'd like to provide a separate row of X-Value data for each row of Y-Value data. I'm not seeing how I can pass this sort of a dataset to objChartChartWizard...is there a way? Thanks very much for any help! Michael |
#6
![]()
Posted to microsoft.public.excel.charting
|
|||
|
|||
![]()
If your objChart is reliably defined, then:
With objChart.SeriesCollection.NewSeries - Jon ------- Jon Peltier, Microsoft Excel MVP Tutorials and Custom Solutions Peltier Technical Services, Inc. - http://PeltierTech.com _______ "mb" wrote in message ... Here's a snippet of my code: OLE1.CreateEmbed "", "Excel.Chart.5" Set objChart = OLE1.object.ActiveChart Set objSheet = objChart.Parent.Worksheets(1) Set objXL = objChart.Application I tried substituting both "OLE1.object.Application" and "objXL" for xlApp in your example: With objXL.ActiveChart.SeriesCollection.NewSeries .Name = ActiveSheet.Range("G3") .Values = ActiveSheet.Range("G4:G14") .XValues = ActiveSheet.Range("A4:A14") End With But I get the error: <Object variable or With block variable not set A watch on objXL shows it equal to "Microsoft Excel", but the ".ActiveChart" provokes the error. Any thoughts? thanks, Michael In article , says... The code is nearly the same. The difference is that you have to qualify the code in VB6 a bit more formally. For instance, you need a variable pointing to the working instance of Excel. Supposing the variable is xlApp, then the code I posted looks like this: With xlApp.ActiveChart.SeriesCollection.NewSeries .Name = ActiveSheet.Range("G3") .Values = ActiveSheet.Range("G4:G14") .XValues = ActiveSheet.Range("A4:A14") End With - Jon ------- Jon Peltier, Microsoft Excel MVP Tutorials and Custom Solutions Peltier Technical Services, Inc. - http://PeltierTech.com _______ "mb" wrote in message . .. Jon, Thanks for the quick reply! The example code you posted appears to be VBA: do you know if you can do the same thing from within a Visual Basic 6 application? I'm currently using Excel 2000 and can update it if necessary, but I"m pretty stuck with VB6. Buying a VB6 add-on to enable this would be a viable alternative. thanks again, Michael In article , says... Michael - Visit this page: http://peltiertech.com/Excel/ChartsH...kChartVBA.html Pay attention to the sections on adding series: Sub AddNewSeries() With ActiveChart.SeriesCollection.NewSeries .Name = ActiveSheet.Range("G3") .Values = ActiveSheet.Range("G4:G14") .XValues = ActiveSheet.Range("A4:A14") End With End Sub - Jon ------- Jon Peltier, Microsoft Excel MVP Tutorials and Custom Solutions Peltier Technical Services, Inc. - http://PeltierTech.com _______ "mb" wrote in message . .. I'm trying to create a XYScatter graph of 3 independent datasets from within VB6 using OLE/Excel2000. I'm using the KB147803 article as a basis, but am stuck and hope someone can help. The example in KB147803 seems to indicate that there can only be one set of X-Values for the 3 XY Scatter Graph data sets. The X-Value series is the first row of data in the sheet, and is called out as a set of Category labels ('cwCategoryLabels=1'), and applies to all three subsequent rows of Y-Value data. In my case, I want to plot 3 independent sets of XY data, so I'd like to provide a separate row of X-Value data for each row of Y-Value data. I'm not seeing how I can pass this sort of a dataset to objChartChartWizard...is there a way? Thanks very much for any help! Michael |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Independent Lists... | New Users to Excel | |||
how to look up values with two independent variables | Excel Worksheet Functions | |||
Help with datapoints stack in XYScatter | Charts and Charting in Excel | |||
Charting 3-D Graphs with Empty Cells | Charts and Charting in Excel | |||
Custom charting - Stacked charting with a line | Charts and Charting in Excel |