Bonjour,

Je code une Userform avec 4 Checkbox.
Voici le code que j'ai pour l'instant, dans le module de l'userform :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
Private Sub UserForm_Initialize()
    OteCroix Me
    If CheckBox1 = "Vrai" And CheckBox2 = "Vrai" And CheckBox3 = "Vrai" And CheckBox4 = "Vrai" Then
    Unload Me
    End If
End Sub
Dans un module standard :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
Option Explicit
 
Declare Function GetWindowLongA Lib "user32" _
(ByVal hwnd As Long, ByVal nIndex As Long) As Long
 
 Declare Function SetWindowLongA Lib "user32" _
(ByVal hwnd As Long, ByVal nIndex As Long, _
ByVal dwNewLong As Long) As Long
 
 Declare Function FindWindowA Lib "user32" _
(ByVal lpClassName As String, ByVal lpWindowName As String) As Long
 
Public Transfer(6) As String
 
Sub OteCroix(UF As UserForm)
Dim hwnd As Long
    'Enlève la croix rouge de l'UF
    hwnd = FindWindowA("Thunder" & IIf(Application.Version Like "8*", "X", "D") _
    & "Frame", UF.Caption)
    SetWindowLongA hwnd, -16, GetWindowLongA(hwnd, -16) And &HFFF7FFFF
End Sub
Je souhaite fermer l'userform lorsque toutes les cases sont cochées.
Sauriez vous comment faire cela ?

Merci,