View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Peter T Peter T is offline
external usenet poster
 
Posts: 5,600
Default Can I get a chart object (excel.ChartObject) from OLE_chart.object

I have no idea what you are after but the code snippets are not right at all

dim EXL_CHRT As excel.ChartObject

SET EXL_CHRT = OLE_chart.object.Charts(1)


instead

Set EXL_CHRT = xlSheet.ChartObjects(1) ' or .ChartObjects("some-name")

where xlSheet refers to the sheet containing the chartobject

You may then want to refer to
EXL_CHRT.Object.Some-method-or-property

FYI, "Charts" refers to the collection chart-sheets in the workbook, if any.
A Chart-sheet can contain chartobjects though that's not typical.

If the above does not clarify describe what you have and what you want to
do.

Regards,
Peter T


"chris" wrote in message
...
I have procedures in VB6 for adding charts on excel worksheets. I use
variable EXL_CHRT (As excel.ChartObject) for setting source data etc.

Now I created an OLE object on a form for chart preview before it is
created. I can access it's worksheet with "OLE_chart.object.Worksheets(1)"
for using my existing procedures for adding charts on worksheets.

Can I get a chart object (As excel.ChartObject) from
OLE_chart.object.Charts(1) in order to use existing procedures for setting
chart settings ?

ex.

dim EXL_CHRT As excel.ChartObject

SET EXL_CHRT = OLE_chart.object.Charts(1)
EXL_CHRT.SetSourceData........

Thanks in advance!