MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Whats the code to change the display text on a checkbox?


Posted by Brian P on April 20, 2001 3:37 PM

Here's part of it
Is it caption?


Set MyCheckBox = MySheet.OLEObjects.Add(ClassType:="Forms.CheckBox.1")
With MyCheckBox
.Left = 44
.Top = 110
.Width = 70
.Height = 16
End With

Thanks


Posted by David Hawley on April 20, 2001 4:03 PM


Hi Brian

Have you tried:

.Caption=


Dave

OzGrid Business Applications

Posted by Brian P on April 20, 2001 4:10 PM


Yes - I've tried it but it doesn't work.
says something like object doesn't support that property.

Posted by anon on April 22, 2001 3:45 AM

For a checkbox from the "Forms Toolbar" instead the "Control Toolbox Toolbar" :-

With ActiveSheet
MyCheckBox = .CheckBoxes.Add(44, 110, 70, 16)
.CheckBoxes(.CheckBoxes.Count).Text = "New Caption"
End With


Posted by Brian P on April 22, 2001 9:38 PM

Hey it worked. Thanks very much!!!!
I wasn't expecting an answer. That was a very nice surprise!