Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default How to create a Macro to Name a Checkbox

Is there a way that I can create a macro to allow me to click a button within
a worksheet that will allow me specify a name for a checkbox?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default How to create a Macro to Name a Checkbox

for control toolbox toolbar controls, you can use

activesheet.OleObjects(2).Name = "OptionButton8"

for optionbuttons from the forms toolbar
activesheet.Optionbuttons(2).Name = "OptionButton8"

If you really meant the caption, then change Name to be Caption.

--
Regards,
Tom Ogilvy

"Stasio" wrote:

Is there a way that I can create a macro to allow me to click a button within
a worksheet that will allow me specify a name for a checkbox?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default How to create a Macro to Name a Checkbox

Tom,
Thanks for the quick response.

I was able to use this as long as I keep it as you have it stated with the
".Name".

I do need it to change for the caption though and when I change ".Name" to
".Caption" i receive a debug error code 438. It states: Object doesn't
support the property or method.


"Tom Ogilvy" wrote:

for control toolbox toolbar controls, you can use

activesheet.OleObjects(2).Name = "OptionButton8"

for optionbuttons from the forms toolbar
activesheet.Optionbuttons(2).Name = "OptionButton8"

If you really meant the caption, then change Name to be Caption.

--
Regards,
Tom Ogilvy

"Stasio" wrote:

Is there a way that I can create a macro to allow me to click a button within
a worksheet that will allow me specify a name for a checkbox?

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default How to create a Macro to Name a Checkbox

Tom,
i figured out what I was doing wrong. I had to modify your example of:

activesheet.Optionbuttons(2).Name = "OptionButton8"

To:

ActiveSheet.CheckBox1.Caption = "OptionButton8"

Thank-you much for all of the assistance.


"Stasio" wrote:

Is there a way that I can create a macro to allow me to click a button within
a worksheet that will allow me specify a name for a checkbox?

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default How to create a Macro to Name a Checkbox

Yes. My error. For control toolbox Toolbar option buttons you would add
"Object" as shown in this demo from the immediate window:

? activesheet.OleObjects(1).Object.Caption
OptionButton1
Activesheet.OleObjects(1).Object.Caption = "House"
? activesheet.OleObjects(1).Object.Caption
House


--
Regards,
Tom Ogilvy


"Stasio" wrote:

Tom,
Thanks for the quick response.

I was able to use this as long as I keep it as you have it stated with the
".Name".

I do need it to change for the caption though and when I change ".Name" to
".Caption" i receive a debug error code 438. It states: Object doesn't
support the property or method.


"Tom Ogilvy" wrote:

for control toolbox toolbar controls, you can use

activesheet.OleObjects(2).Name = "OptionButton8"

for optionbuttons from the forms toolbar
activesheet.Optionbuttons(2).Name = "OptionButton8"

If you really meant the caption, then change Name to be Caption.

--
Regards,
Tom Ogilvy

"Stasio" wrote:

Is there a way that I can create a macro to allow me to click a button within
a worksheet that will allow me specify a name for a checkbox?



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default How to create a Macro to Name a Checkbox

That wouldn't be meaningful in code unless you just added the Checkbox.
Hard coding the name of the control in your code, at least to me, doesn't
make sense to perform that type of action. I have posted an alternative
method elsewhere in the thread.

--
Regards,
Tom Ogilvy


"Stasio" wrote:

Tom,
i figured out what I was doing wrong. I had to modify your example of:

activesheet.Optionbuttons(2).Name = "OptionButton8"

To:

ActiveSheet.CheckBox1.Caption = "OptionButton8"

Thank-you much for all of the assistance.


"Stasio" wrote:

Is there a way that I can create a macro to allow me to click a button within
a worksheet that will allow me specify a name for a checkbox?

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Create a Fuctioning Checkbox Richard Excel Discussion (Misc queries) 4 July 25th 08 09:09 PM
How do I create a checkbox in MS Excel? Tna Excel Discussion (Misc queries) 1 September 15th 06 03:49 AM
Create CheckBox from a row Matan Excel Programming 0 May 5th 04 02:26 PM
how do I create a checkbox? alexvanas Excel Programming 2 April 23rd 04 06:31 PM
Will Excel create a checkbox? CherylCGO Excel Programming 4 April 23rd 04 04:36 PM


All times are GMT +1. The time now is 11:15 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"