?
Solved

VBA: how to reset checkboxes inside a frame

Posted on 2009-07-01
3
Medium Priority
?
610 Views
Last Modified: 2013-11-26
Hi x-perts,

is there a way to reset ALL checkboxes inside of a frame?

Thanks
0
Comment
Question by:andy7789
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 65

Accepted Solution

by:
RobSampson earned 2000 total points
ID: 24775269
Hi there,

I haven't tested these options, but you can either of the two below.

Regards,

Rob.
' Option 1
    Dim ckBox As OLEObject
    For Each ckBox In MyForm.MyFrame.OLEObjects
        If TypeName(ckBox) ="CheckBox" Then ckBox.Object.Value = 0
    Next ckBox
 
'Option 2
For Each objControl In MyForm.MyFrame.Controls 
    If TypeName(objControl) ="CheckBox" Then 
        ckBox.Object.Value = 0
    End If 
Next ctl 

Open in new window

0
 

Author Comment

by:andy7789
ID: 24778228
Thanks, Rob,

none of your versions worked, but this is a slightly modified one that makes its job:

Cheers,

Andy
For Each objControl In Me.Frame2.Controls
    If TypeName(objControl) = "CheckBox" Then
       objControl.Value = 0
   End If
Next objControl

Open in new window

0
 
LVL 65

Expert Comment

by:RobSampson
ID: 24778502
Oh yeah, typo in my option 2....sorry about that.

Thanks for the grade.

Regards,

Rob.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
With User Account Control (UAC) enabled in Windows 7, one needs to open an elevated Command Prompt in order to run scripts under administrative privileges. Although the elevated Command Prompt accomplishes the task, the question How to run as script…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month12 days, 9 hours left to enroll

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question