PDA

View Full Version : Select OLEobject checkbox PROGRAMMATICALLY???



phaothu
09-07-2011, 11:01 AM
Hi evrybody,
I have an interesting question. I have an Excel workbook with only one Excel sheet on which I created a commandbutton. My intention is to generate an activeX control checkbox on the same Excel sheet after this command button is clicked and then check this checkbox PROGRAMMATICALLY. The former task of creating an activeX control checkbox is sucessfully done but I don't know how to come up with a solution for the latter.
The associated click event VBA code done so far for this command button is as follow:

Private Sub CommandButton1_Click()

Dim mybox As New OLEObject

'create CheckBox
Set mybox = ActiveSheet.OLEObjects.Add(ClassType:="forms.CheckBox.1")

'specify geometric properties
With mybox
.Left = 380
.Top = 29
.Width = 100
.Height = 18
End With
'?????????????????????????????
'how to check the created checkbox PROGRAMMATICALLY???
'?????????????????????????????
End Sub

Can anyone give me a hand???
Thank you very much in advance,

Kenneth Hobs
09-07-2011, 11:15 AM
See my reply at MrExcel.

For crossposting see: http://www.excelguru.ca/node/7