I
itdept
My goal is to reuse the chartobject in a given sheet (ws).
int iCount = ws.ChartObjects.Count;
Excel.ChartObject myChartObject;
if( iCount > 0)
{
myChartObject = (Excel.ChartObject)ws.ChartObjects(iCount);
}
else
{
Excel.ChartObjects chartObjects =
(Excel.ChartObjects)ws.ChartObjects(missing);
myChartObject = chartObjects.Add(100, 100, 400, 300);
}
....
But this code couldn't compile due to:
Microsoft.Office.Interop.Excel._Worksheet.ChartObjects(object)' is a
'method', which is not valid in the given context
How could we detect if the existing ChartObject in a sheet? Could any
one help?
Thanks in advance for any hint.
--PD
int iCount = ws.ChartObjects.Count;
Excel.ChartObject myChartObject;
if( iCount > 0)
{
myChartObject = (Excel.ChartObject)ws.ChartObjects(iCount);
}
else
{
Excel.ChartObjects chartObjects =
(Excel.ChartObjects)ws.ChartObjects(missing);
myChartObject = chartObjects.Add(100, 100, 400, 300);
}
....
But this code couldn't compile due to:
Microsoft.Office.Interop.Excel._Worksheet.ChartObjects(object)' is a
'method', which is not valid in the given context
How could we detect if the existing ChartObject in a sheet? Could any
one help?
Thanks in advance for any hint.
--PD