Option Explicit
Public WithEvents GroupOpt As MSForms.OptionButton
Dim cls() As New UF_NouveauFichier
Private Sub UserForm_Activate()
Dim a&, opt
Me.Repaint
For Each opt In Me.Controls
If " Frame1 Frame2 " Like "*" & opt.Parent.Name & "*" Then
a = a + 1: ReDim Preserve cls(1 To a): Set cls(a).GroupOpt = opt
End If
Next
End Sub
Private Sub TxbNomFeuile_Change(): ControlEenable: End Sub
Private Sub Btn_Annuler_Click(): Unload UF_NouveauFichier:End Sub
Private Sub groupopt_Click(): ControlEenable: End Sub 'un seul event pour tout les optionbutton
Sub ControlEenable()
Dim q&, ctrl
For Each ctrl In UF_NouveauFichier.Controls
If " Frame1 Frame2 " Like "*" & ctrl.Parent.Name & "*" Then
If ctrl.Value = True Then q = q + 1
End If
Next
If UF_NouveauFichier.Controls("TxbNomFeuile").Value <> "" Then q = q + 1
UF_NouveauFichier.Controls("Btn_Valider").Enabled = (q = 3)
End Sub