Public Function Fields_Check(ByVal MyUserForm As UserForm) As Boolean Dim FieldsOk As Boolean FieldsOk = True On Error Resume Next For Each MyControl In MyUserForm.Controls If MyControl.Value = "" Then MsgBox "Veuillez remplir tous les champs", vbOKOnly, "Informations" FieldsOk = False Exit For End If Next ctl On Error GoTo 0 Fields_Check = FieldsOk End Function
Dim MyControl As Control
Dim FieldsOk As Boolean
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionPublic Function Fields_Check(ByVal MyUserForm As UserForm) As Boolean Dim FieldsOk As Boolean Dim MyControl As Control FieldsOk = True For Each MyControl In MyUserForm.Controls If TypeOf MyControl Is msforms.TextBox Or TypeOf MyControl Is msforms.ComboBox Then If MyControl.Value = "" Then MsgBox "Veuillez remplir tous les champs", vbOKOnly, "Informations" FieldsOk = False Exit For End If End If Next MyControl Fields_Check = FieldsOk End Function