Can you refer to a group in VBA?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Sandra Walsh
    New Member
    • Nov 2011
    • 62

    Can you refer to a group in VBA?

    I want to toggle the "visible" property of a large number of fields and lables depending on certain conditions.

    Instead of writing a "set visible" for each field, can I group them and set the visible property for a group?

    I have not been able to find how to name or refer to a group. Maybe this is not doable?
  • NeoPa
    Recognized Expert Moderator MVP
    • Oct 2006
    • 32662

    #2
    You can't do that, but you can use a For Each X In Me.Controls construct to go through all controls in a VBA loop as long as you have something by which to identify the controls you're interested in.

    Comment

    • NeoPa
      Recognized Expert Moderator MVP
      • Oct 2006
      • 32662

      #3
      Another, less obvious, item is the .ControlType property of controls. It's not actually a property of Control itself, but it is a common property to all the built-in controls so is pretty safe to use. This way, you can check though all the controls and ignore any that aren't even the types you're looking for (EG. acTextBox is the ControlType for a Text Box control).

      Comment

      Working...