InvalidSyntax
InvalidSyntax

Reputation: 9495

VBA Multiple Objects with 'With' Statement

I have a check box that when checked multiple boxes are disabled on my form. Currently im using

With Me!Textbox
.Locked = True

Is there a method where I can list multiple objects within the With statement rather than writing out each time for every textbox

e.g.

With Me!Text1, Text2, Text3

Upvotes: 3

Views: 2704

Answers (1)

Fionnuala
Fionnuala

Reputation: 91356

It may be easiest to add something to the tag property to identify the relevant controls, "lock", say. Then you can iterate over the controls collection and lock anything with a tag set to "lock".

Upvotes: 2

Related Questions