Problem with setting chart size in VB.NET

X

XxLicherxX

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top