Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default For Each Ctl In Me.Controls


Merry Christmas and a Happy New Year.


I want to

#1. Identify controls in my userform1 as checkbox

#2.Find out how many and which checkboxes are checked

#3. Run another process using the selected enabled checkboxes.

Me.Controls does not work.

I tried:

Dim ctrl As MSForms.Control
Dim cbox As MSForms.CheckBox

For Each ctrl In Me.Controls

If TypeOf ctrl Is MSForms.CheckBox Then
Set cbox = ctrl
msgbox cbox.Name
End If

Next



My computer stops at the first line: :

"For Each ctrl In Me.Controls"

and gives:

"Run-time error '438'"
"Object doesn't support this object or method

Please help me,

Jose
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default For Each Ctl In Me.Controls

Works fine for me. You have that code in the form?


--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"LongBeachGuy" wrote in message
...

Merry Christmas and a Happy New Year.


I want to

#1. Identify controls in my userform1 as checkbox

#2.Find out how many and which checkboxes are checked

#3. Run another process using the selected enabled checkboxes.

Me.Controls does not work.

I tried:

Dim ctrl As MSForms.Control
Dim cbox As MSForms.CheckBox

For Each ctrl In Me.Controls

If TypeOf ctrl Is MSForms.CheckBox Then
Set cbox = ctrl
msgbox cbox.Name
End If

Next



My computer stops at the first line: :

"For Each ctrl In Me.Controls"

and gives:

"Run-time error '438'"
"Object doesn't support this object or method

Please help me,

Jose



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
add controls stewart Excel Programming 0 September 10th 07 12:47 AM
using gui controls daddy260 Excel Discussion (Misc queries) 4 May 25th 07 07:35 AM
Excel controls vs vba controls cmpcwil2[_6_] Excel Programming 3 April 19th 06 03:33 PM
ActiveX Controls vs Form Controls Alex Excel Discussion (Misc queries) 1 January 11th 06 08:46 AM
Event procedures for controls added with Controls.Add John Austin[_4_] Excel Programming 1 March 9th 05 03:31 PM


All times are GMT +1. The time now is 10:39 PM.

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"