By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,298 Members | 1,691 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,298 IT Pros & Developers. It's quick & easy.

Can you refer to a group in VBA?

P: 62
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?
Dec 21 '11 #1

✓ answered by NeoPa

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.

Share this Question
Share on Google+
2 Replies


NeoPa
Expert Mod 15k+
P: 31,707
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.
Dec 22 '11 #2

NeoPa
Expert Mod 15k+
P: 31,707
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).
Jan 19 '12 #3

Post your reply

Sign in to post your reply or Sign up for a free account.