View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
XxLicherxX XxLicherxX is offline
external usenet poster
 
Posts: 2
Default Problem with setting chart size in VB.NET

Hello everyone,

I am using VB.NET to automate the create of Excel files. The file that
I am creating has many charts in it. I am having a problem setting the
chart size. I am trying to do this with ChartArea.width. The problem is
everytime I even refer to ChartArea.width (or anything having to do
with ChartArea) the program crashes and gives me the error:

An unhandled exception of type
'System.Runtime.InteropServices.COMException' occurred in CSTXL.exe

Additional information: Exception from HRESULT: 0x800401A8.


What does this error even mean and what can I do about it?

Here is how I am creating the chart:

oResizeRange = oWS.Range(RangeString)

oChart = oWS.Parent.Charts.Add
With oChart
.ChartWizard(oResizeRange, Excel.XlChartType.xl3DColumn, ,
Excel.XlRowCol.xlColumns)
oSeries = .SeriesCollection(1)
oSeries.XValues = oWS.Range(xValueStart, xValueEnd)
.SeriesCollection(1).Name = ChartName
.Location(Excel.XlChartLocation.xlLocationAsObject ,
oWS.Name)
.ChartArea.Width = 100 '<--------------- CRASH

End With

Thanks