ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Creation and property manipulation of Control Checkbox using VB (https://www.excelbanter.com/excel-programming/415016-creation-property-manipulation-control-checkbox-using-vbulletin.html)

brg

Creation and property manipulation of Control Checkbox using VB
 
I have created a tool that allows the user to import specific data from a
related spreadsheet. This data gets pasted into the next open row in a table
in the open spreadsheet.

I'm looking for a method to create a new control checkbox in the rightmost
column whenever a new row is created in the table. I'd also like to
manipulate the properties of the button, for instance link the button to the
cell beneath, set the size of the button to be the same as the linked cell,
change the button's colour and caption etc. Any hints would be greatly
appreciated
--
BRG

Jim Thomlinson

Creation and property manipulation of Control Checkbox using VB
 
Here is some quick and dirty code to get you started...

Dim ctl As OLEObject

Set ctl = activesheet.OLEObjects.Add(ClassType:="Forms.Check Box.1")

ctl.TopLeftCell = ActiveCell
ctl.Object.Caption = "Tada"
--
HTH...

Jim Thomlinson


"BRG" wrote:

I have created a tool that allows the user to import specific data from a
related spreadsheet. This data gets pasted into the next open row in a table
in the open spreadsheet.

I'm looking for a method to create a new control checkbox in the rightmost
column whenever a new row is created in the table. I'd also like to
manipulate the properties of the button, for instance link the button to the
cell beneath, set the size of the button to be the same as the linked cell,
change the button's colour and caption etc. Any hints would be greatly
appreciated
--
BRG


brg

Creation and property manipulation of Control Checkbox using V
 
Hey Jim,

Thanks for the tip, that was what I was looking for. Just a quick question
out of curiosity, the checkboxes that are created with this code are
different than the checkboxes that I create using the controls toolbar, for
instance I can't right click on these checkboxes to access their properties.
In the code you sent the class type is "Forms.CheckBox.1". Is this actually
equivalent to a Forms checkbox? And if so how do you create a "Controls"
checkbox?

Thanks,
--
BRG


"Jim Thomlinson" wrote:

Here is some quick and dirty code to get you started...

Dim ctl As OLEObject

Set ctl = activesheet.OLEObjects.Add(ClassType:="Forms.Check Box.1")

ctl.TopLeftCell = ActiveCell
ctl.Object.Caption = "Tada"
--
HTH...

Jim Thomlinson


"BRG" wrote:

I have created a tool that allows the user to import specific data from a
related spreadsheet. This data gets pasted into the next open row in a table
in the open spreadsheet.

I'm looking for a method to create a new control checkbox in the rightmost
column whenever a new row is created in the table. I'd also like to
manipulate the properties of the button, for instance link the button to the
cell beneath, set the size of the button to be the same as the linked cell,
change the button's colour and caption etc. Any hints would be greatly
appreciated
--
BRG



All times are GMT +1. The time now is 02:24 PM.

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