PC Review


Reply
Thread Tools Rate Thread

How to create a Macro to Name a Checkbox

 
 
=?Utf-8?B?U3Rhc2lv?=
Guest
Posts: n/a
 
      29th May 2007
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 With Quote
 
 
 
 
=?Utf-8?B?VG9tIE9naWx2eQ==?=
Guest
Posts: n/a
 
      29th May 2007
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?

 
Reply With Quote
 
=?Utf-8?B?U3Rhc2lv?=
Guest
Posts: n/a
 
      29th May 2007
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?

 
Reply With Quote
 
=?Utf-8?B?U3Rhc2lv?=
Guest
Posts: n/a
 
      29th May 2007
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 With Quote
 
=?Utf-8?B?VG9tIE9naWx2eQ==?=
Guest
Posts: n/a
 
      29th May 2007
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?

 
Reply With Quote
 
=?Utf-8?B?VG9tIE9naWx2eQ==?=
Guest
Posts: n/a
 
      29th May 2007
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 With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
in a form create a macro to change a checkbox to checked =?Utf-8?B?amNhYmlhbw==?= Microsoft Word Document Management 4 10th May 2006 12:28 AM
How do you create a checkbox in a column? =?Utf-8?B?TllMaWJlcnR5ZmFu?= Microsoft Access Getting Started 7 2nd Feb 2005 11:53 PM
Master-Detail Datagrid -checkbox (once tick the checkbox, all the child checkbox is ticked) Agnes Microsoft VB .NET 0 16th Aug 2004 11:23 AM
Create CheckBox from a row =?Utf-8?B?TWF0YW4=?= Microsoft Excel Programming 0 5th May 2004 02:26 PM
how do I create a checkbox? alexvanas Microsoft Excel Programming 2 23rd Apr 2004 06:31 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:30 AM.