Select OLEobject checkbox PROGRAMMATICALLY???

phaothu

New Member
Joined
Aug 25, 2011
Messages
3
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(<WBR>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???
'???????????????????????????<WBR>??
End Sub

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

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
Code:
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
    .Object.Value = True
  End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,502
Messages
6,179,126
Members
452,890
Latest member
Nikhil Ramesh

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top