set/get value of checkbox (controltoolbox)

J

Jesper F

Trying to get/set value from a checkbox.
I'm using the controltoolbox-checkbox.
I'm using:
Worksheets("refdata").Shapes(varname).ControlFormat.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.
 
D

Dave Peterson

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
 

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

Similar Threads


Top