vendredi 25 août 2017

How to define Array of checkboxes in VBA

I know similar questions have been asked before like this and this but I was having issues with initializing the checkbox array object (My VBA is quite rusty).

I have the following code:

Dim chkAdQ(4) As Checkbox

Set chkAdQ(0) = chkAdQ1
Set chkAdQ(1) = chkAdQ2
Set chkAdQ(2) = chkAdQ3
Set chkAdQ(3) = chkAdQ4

where chkAdQ1, chkAdQ2 etc. are ActiveX checkboxes present on the form. On debugging I can see that chkAdQ(4) prompts 'nothing' on the declaration itself and hence the assignment gives a Type mismatch exception.

I also tried by declaring chkAdQ(4) as an Object but to no avail. Any thoughts?




Aucun commentaire:

Enregistrer un commentaire