change the title of a checkbox

D

daMike

Hello,

I have to know how I can change the title of a checkbox
with VBA code. The checkbox is placed on a chart so I see
no way - at the moment - how i can access the title ..
or other checkbox properties? Does anybody know how it
works?

Thanks in advance!
Michael
 
A

Andy Pope

Hi Michael,

For a chart create on a worksheet with a checkbox contained within the
chart try something like this.

Sub Test()
With ActiveSheet.ChartObjects(1)
' display caption
MsgBox .Chart.Shapes("Check box 1").TextFrame.Characters.Text
' display tick status 1=ticked -4146=unticked
MsgBox .Chart.Shapes("Check box 1").ControlFormat.Value
End With
End Sub

Hello,

I have to know how I can change the title of a checkbox
with VBA code. The checkbox is placed on a chart so I see
no way - at the moment - how i can access the title ..
or other checkbox properties? Does anybody know how it
works?

Thanks in advance!
Michael

--

Cheers
Andy

http://www.andypope.info
 
D

daMike

Hi Andy,

the chart isn't on a worksheet. How can I find out what number
the ChartObject has (checkbox)? Does it work for not-embedded
charts too?

Thanks in advance!
daMike
 
A

Andy Pope

Hi,

Yes it will also work for chartsheets.
Just modify the code slightly.

Sub Test()
With Charts("Chart1")
' display caption
MsgBox .Shapes("Check box 1").TextFrame.Characters.Text
' display tick status 1=ticked -4146=unticked
MsgBox .Shapes("Check box 1").ControlFormat.Value
End With
End Sub

The name of the checkboxes appears in the Name Box when the control is
selected.
Hi Andy,

the chart isn't on a worksheet. How can I find out what number
the ChartObject has (checkbox)? Does it work for not-embedded
charts too?

Thanks in advance!
daMike

--

Cheers
Andy

http://www.andypope.info
 
J

Jon Peltier

To use this for any chart, select the chart and run:

Sub Test()
With ActiveChart
' display caption
MsgBox .Shapes("Check box 1").TextFrame.Characters.Text
' display tick status 1=ticked -4146=unticked
MsgBox .Shapes("Check box 1").ControlFormat.Value
End With
End Sub

- Jon
 

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