lundi 22 décembre 2014

Excel userform checkboxes null

I have created a userform and added a chekcbox called 'DSSSContact'. I have written some code to check the contents of the userform before saving in the following sub:



Private Sub SaveandClose_Click()


When the form is initialized the checkbox is set greyed out but ticked - which I think means the value is null. The SavandClose sub code includes the following which I thought would make sure that checkbox is either set to true or false:



If DSSSContact = Null Then
MsgBox "DSSS Contact Test"
Exit Sub
End If


However when I save and close the form using the save and close command button without having made a selection on the checkbox the form saves the contents without triggering the message box. All the other checks that I have created to verify that textboxes and combo boxes are populated are working fine. I have also added the following code within the same sub:



Debug.Print Me.DSSSContact.Value


This prints null in the Immediate window


Any help much appreciated. Thanks





Aucun commentaire:

Enregistrer un commentaire