Refer to a control inserted in chart

  • Thread starter Thread starter Francisco Gomez
  • Start date Start date
F

Francisco Gomez

I have inserted a checkBox in a chart. I need to refer to it programatically,
buy I must not use the control's name, because I plan to copy-paste the sheet
(chart is embedde on it) many times, and control (two checkboxes and one
command button) names change.

I have tried to search it by type (an later by 'caption' -it doesnt change
through copy-paste), in OLEObjects collection

For each obj in ActiveChart.OLEObjects

But ActiveCharts.OLEObjects is an empty collection for me.

Can you help me with this problem?
 
Sub GetMeThere()
Dim obj As Shape
For Each obj In ActiveChart.Shapes
MsgBox obj.TextFrame.Characters.Caption 'or Text
Next
End Sub
--
No, it has never made a whole lot of sense to me either. <g>

Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)



"Francisco Gomez"
wrote in message
I have inserted a checkBox in a chart. I need to refer to it programatically,
buy I must not use the control's name, because I plan to copy-paste the sheet
(chart is embedde on it) many times, and control (two checkboxes and one
command button) names change.

I have tried to search it by type (an later by 'caption' -it doesnt change
through copy-paste), in OLEObjects collection

For each obj in ActiveChart.OLEObjects

But ActiveCharts.OLEObjects is an empty collection for me.

Can you help me with this problem?
 
Another way:

Dim CBX As CheckBox
For Each CBX In ActiveChart.CheckBoxes
MsgBox CBX.Caption
Next CBX
 

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

Back
Top