Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Obtaining Checkbox Name

Hi - I have a form with a large number of identical checkboxes on it. All
were created from the Forms toolbox. I would like to have one macro service
all checkboxes when they are checked or unchecked, however I have been unable
to figure out how to obtain the name of the invoking checkbox.

Thanks,
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 747
Default Obtaining Checkbox Name

MsgBox ActiveSheet.CheckBoxes(Application.Caller).Caption

Regards,
Greg

"RjS, CISSP" wrote:

Hi - I have a form with a large number of identical checkboxes on it. All
were created from the Forms toolbox. I would like to have one macro service
all checkboxes when they are checked or unchecked, however I have been unable
to figure out how to obtain the name of the invoking checkbox.

Thanks,

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Obtaining Checkbox Name

Hmmmm - Thanks... But that gets the caption (or label) but still does not
return the name of the checkbox so I can use it to test for Checked or
UnChecked.

"Greg Wilson" wrote:

MsgBox ActiveSheet.CheckBoxes(Application.Caller).Caption

Regards,
Greg

"RjS, CISSP" wrote:

Hi - I have a form with a large number of identical checkboxes on it. All
were created from the Forms toolbox. I would like to have one macro service
all checkboxes when they are checked or unchecked, however I have been unable
to figure out how to obtain the name of the invoking checkbox.

Thanks,

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 747
Default Obtaining Checkbox Name

The code was intended only as a demo to show that the identity could be
captured. The Application.Caller statement returns the name of the object
that called the running procedure as a text string - i.e. Application.Caller
by itself is what you are looking for. (Run MsgBox Application.Caller).

Regards,
Greg

"RjS, CISSP" wrote:

Hmmmm - Thanks... But that gets the caption (or label) but still does not
return the name of the checkbox so I can use it to test for Checked or
UnChecked.

"Greg Wilson" wrote:

MsgBox ActiveSheet.CheckBoxes(Application.Caller).Caption

Regards,
Greg

"RjS, CISSP" wrote:

Hi - I have a form with a large number of identical checkboxes on it. All
were created from the Forms toolbox. I would like to have one macro service
all checkboxes when they are checked or unchecked, however I have been unable
to figure out how to obtain the name of the invoking checkbox.

Thanks,

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Obtaining Checkbox Name

Sub Checkbox1_Click()
Dim sValue
With ActiveSheet.CheckBoxes(Application.Caller)
Select Case .Value
Case xlOn: sValue = "checked"
Case xlOff: sValue = "un-checked"
Case xlMixed: sValue = "mixed"
End Select

MsgBox "Name " & .Name & vbCr & _
"Caption " & .Caption & vbCr & _
"Checked " & .Value & " " & sValue
End With
End Sub

Regards,
Peter T

"RjS, CISSP" wrote in message
...
Hmmmm - Thanks... But that gets the caption (or label) but still does not
return the name of the checkbox so I can use it to test for Checked or
UnChecked.

"Greg Wilson" wrote:

MsgBox ActiveSheet.CheckBoxes(Application.Caller).Caption

Regards,
Greg

"RjS, CISSP" wrote:

Hi - I have a form with a large number of identical checkboxes on it.

All
were created from the Forms toolbox. I would like to have one macro

service
all checkboxes when they are checked or unchecked, however I have been

unable
to figure out how to obtain the name of the invoking checkbox.

Thanks,





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Obtaining Checkbox Name

Thanks for the responses guys. You pointed me in the right direction and now
I have it mostly figured out. Much appreciated.

I do note that it seems that VBA works one way when the checkbox was created
with the forms toolbox and another when the checkbox was created with the
Control Toolbox... very confusing! Is there a good book out there with
examples you can recommend?

"Greg Wilson" wrote:

The code was intended only as a demo to show that the identity could be
captured. The Application.Caller statement returns the name of the object
that called the running procedure as a text string - i.e. Application.Caller
by itself is what you are looking for. (Run MsgBox Application.Caller).

Regards,
Greg

"RjS, CISSP" wrote:

Hmmmm - Thanks... But that gets the caption (or label) but still does not
return the name of the checkbox so I can use it to test for Checked or
UnChecked.

"Greg Wilson" wrote:

MsgBox ActiveSheet.CheckBoxes(Application.Caller).Caption

Regards,
Greg

"RjS, CISSP" wrote:

Hi - I have a form with a large number of identical checkboxes on it. All
were created from the Forms toolbox. I would like to have one macro service
all checkboxes when they are checked or unchecked, however I have been unable
to figure out how to obtain the name of the invoking checkbox.

Thanks,

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
How to have Checkbox A uncheck with checked Checkbox B Texas Aggie Excel Discussion (Misc queries) 3 July 20th 07 10:58 PM
Obtaining a positive variance % Bartman0609 Excel Discussion (Misc queries) 3 June 20th 06 04:38 PM
Obtaining sum for multiple criteria Teri Excel Discussion (Misc queries) 4 November 23rd 05 11:06 PM
Obtaining OS language Max Potters Excel Programming 3 December 31st 04 01:56 PM
obtaining the name of a button jmoffat[_4_] Excel Programming 2 December 2nd 03 02:57 PM


All times are GMT +1. The time now is 12:17 AM.

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

About Us

"It's about Microsoft Excel"