SKSR
New member
Error generating chart in Excel
Hi, this is my first thread here.
Im trying to generate a Column Clustered chart in Excel. But Im coming across the following error: (However, this works fine for Excel.XlChartType.xl3DColumn, and Excel.XlChartType.xlLine but not Excel.XlChartType.xlColumnClustered )
An unhandled exception of type System.Runtime.InteropServices.COMException occurred in ExcelCharting.exe
Additional information: Exception from HRESULT: 0x800A03EC.
My code is as follows:
---------------- CODE BEGIN -----------------------
oChart = (Excel._Chart)nExlWkBook.Charts.Add(Missing.Value, Missing.Value,
Missing.Value, Missing.Value );
oChart.Activate();
oResizeRange = nExlWkSheet.get_Range("B2:M3", Missing.Value);
oChart.ChartWizard(oResizeRange, Excel.XlChartType.xlColumnClustered, Missing.Value,
Excel.XlRowCol.xlRows, Missing.Value, Missing.Value, Missing.Value,
Missing.Value, Missing.Value, Missing.Value, Missing.Value);
oSeries = (Excel.Series)oChart.SeriesCollection(1);
oSeries.XValues = nExlWkSheet.get_Range("B1", "M1");
oSeries.Name = "Go Lives";
oSeries = (Excel.Series)oChart.SeriesCollection(2);
oSeries.Name = "Go Lives(planned)";
oChart.Location( Excel.XlChartLocation.xlLocationAsObject, nExlWkSheet.Name );
------------ CODE END -----------------------
The get_range values are good. But I am not sure as to why it is not able to generate the Chart.
Any Suggestions are really appreciated
Hi, this is my first thread here.
Im trying to generate a Column Clustered chart in Excel. But Im coming across the following error: (However, this works fine for Excel.XlChartType.xl3DColumn, and Excel.XlChartType.xlLine but not Excel.XlChartType.xlColumnClustered )
An unhandled exception of type System.Runtime.InteropServices.COMException occurred in ExcelCharting.exe
Additional information: Exception from HRESULT: 0x800A03EC.
My code is as follows:
---------------- CODE BEGIN -----------------------
oChart = (Excel._Chart)nExlWkBook.Charts.Add(Missing.Value, Missing.Value,
Missing.Value, Missing.Value );
oChart.Activate();
oResizeRange = nExlWkSheet.get_Range("B2:M3", Missing.Value);
oChart.ChartWizard(oResizeRange, Excel.XlChartType.xlColumnClustered, Missing.Value,
Excel.XlRowCol.xlRows, Missing.Value, Missing.Value, Missing.Value,
Missing.Value, Missing.Value, Missing.Value, Missing.Value);
oSeries = (Excel.Series)oChart.SeriesCollection(1);
oSeries.XValues = nExlWkSheet.get_Range("B1", "M1");
oSeries.Name = "Go Lives";
oSeries = (Excel.Series)oChart.SeriesCollection(2);
oSeries.Name = "Go Lives(planned)";
oChart.Location( Excel.XlChartLocation.xlLocationAsObject, nExlWkSheet.Name );
------------ CODE END -----------------------
The get_range values are good. But I am not sure as to why it is not able to generate the Chart.
Any Suggestions are really appreciated
Last edited by a moderator: