ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   set/get value of checkbox (controltoolbox) (https://www.excelbanter.com/excel-programming/445809-set-get-value-checkbox-controltoolbox.html)

Jesper F

set/get value of checkbox (controltoolbox)
 
Trying to get/set value from a checkbox.
I'm using the controltoolbox-checkbox.
I'm using:
Worksheets("refdata").Shapes(varname).ControlForma t.Value = 1

but getting a object does not support property error.
I need to refer to the checkbox with "varname" being af changable variable.

What is the correct syntax?
Thanks.

Dave Peterson[_2_]

set/get value of checkbox (controltoolbox)
 
I'd use something like:

Option Explicit
Sub testme()
Dim CBX As OLEObject
Set CBX = Worksheets("sheet1").OLEObjects("checkbox1")

CBX.Object.Value = True

End Sub



On 04/18/2012 06:21, Jesper F wrote:
Trying to get/set value from a checkbox.
I'm using the controltoolbox-checkbox.
I'm using:
Worksheets("refdata").Shapes(varname).ControlForma t.Value = 1

but getting a object does not support property error.
I need to refer to the checkbox with "varname" being af changable variable.

What is the correct syntax?
Thanks.


--
Dave Peterson


All times are GMT +1. The time now is 09:54 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com