Can I get a chart object (excel.ChartObject) from OLE_chart.ob
Set EXL_OLE_chrt = ole_excel_chart.object.Charts(1)).
You say you created a chart with the above but that cannot work in Excel, as
I tried to explain before that syntax is incorrect.
Assuming you are working with an embedded chart on a sheet
Dim xlChtObj as Excel.Chart
Dim xlCht as Excel.Chart
' assumes an embedded chart exists on the sheet
Set xlChtObj = xlSheet.ChartObjects(1)
Set xlCht = xlChtObj.Object.Chart
call foo(xlChtObj.Object)
or
call foo(xlCht)
Function foo(cht as Excel.Chart)
'do stuff
End Function
Note the object property of the "ChartObject" is the "Chart" (ChartObject
might have been better named as say "ChartHolder").
If you are working with a chart sheet, the entire sheet is a "Chart" object,
you can also have embedded ChartObjects on a Chart sheet.
Regards,
Peter T
"chris" wrote in message
...
Thanks Peter for your message.
My existing procedures use (dim EXL_CHRT As excel.ChartObject) for setting
chart's properties.
Now I created an OLE object (Excel Chart). (Dim EXL_OLE_chrt As
Excel.Chart
- Set EXL_OLE_chrt = ole_excel_chart.object.Charts(1)).
I was wondering whether I can access same object from both (EXL_CHRT &
EXL_OLE_chrt) so I can pass them as parameter to procedure for setting
chart
properties instead of having 2 procedures, one for each type (ChartObject
or
Chart).
|