If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
change the title of a checkbox
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 |
#2
|
|||
|
|||
change the title of a checkbox
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 daMike wrote: 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 |
#3
|
|||
|
|||
change the title of a checkbox
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 Andy Pope wrote in message ... 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 daMike wrote: 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 |
#4
|
|||
|
|||
change the title of a checkbox
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. daMike wrote: 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 Andy Pope wrote in message ... 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 daMike wrote: 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 |
#5
|
|||
|
|||
change the title of a checkbox
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 ------- Jon Peltier, Microsoft Excel MVP http://www.geocities.com/jonpeltier/Excel/index.html _______ Andy Pope wrote: 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. daMike wrote: 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 Andy Pope wrote in message ... 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 daMike wrote: 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 |
Thread Tools | |
Display Modes | |
|
|