mardi 26 mai 2015

VB - change property of all checkboxes

I am very naive with programming in general and Visual Basic in particular.

My question sounds really stupid and irrelevant, but I have been struggling with it since a couple of hours.

I am writing a survey using Microsoft Office and the Visual Basic environment to take advantage of functions like check-box, buttons etc .

I was wondering whether there is way to change all at once a property of all my check-boxes (e.g. the font color)? That is, if I press the button X all the check-boxes turn red (this is a stupid example, is a bit more complicated). I know I have to address the field .ForeColor but I do not know whether is possible to change it for all the check-boxes at the same time (and they're really a lot, so changing the property one by one or creating manually an array is out of question :p ).

My check-boxes are named Q1A, Q1B, Q1C, Q2A, Q2B ...Is there a way to use a wildcard like "", e.g. Q.ForeColor = &HFF& ?, in a way to apply these properties to all the check-boxes which name starts with "Q"?

I hope I made myself clear, thanks in advance!




Aucun commentaire:

Enregistrer un commentaire