Bonjour,
Peut-on supprimer la croix en haut à droite sur un UserForm ?
Si oui, de quel manière ?
Merci
Bien cordialement
Bonjour,
Peut-on supprimer la croix en haut à droite sur un UserForm ?
Si oui, de quel manière ?
Merci
Bien cordialement
Bonsoir
ce code Supprime la croix de fermeture d'un UserForm
A placer au début du module de code de ton UserForm :
Bonne soirée
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 Private Declare Function GetWindowLongA Lib "user32" _ (ByVal hwnd As Long, ByVal nIndex As Long) As Long Private Declare Function SetWindowLongA Lib "user32" _ (ByVal hwnd As Long, ByVal nIndex As Long, _ ByVal dwNewLong As Long) As Long Private Declare Function FindWindowA Lib "user32" _ (ByVal lpClassName As String, ByVal lpWindowName As String) As Long Private Sub UserForm_Initialize() Dim hwnd As Long hwnd = FindWindowA("Thunder" & IIf(Application.Version Like "8*", _ "X", "D") & "Frame", Me.Caption) SetWindowLongA hwnd, -16, GetWindowLongA(hwnd, -16) And &HFFF7FFFF End Sub
Abed_H![]()
Re,
Ce deuxième code permet de supprimer la barre de titre d'un UserForm, afin de forcer l’usager de cliquer sur un bouton de validation des données situé dans l’userform avant de sortir du programme.
Bonne soirée
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 Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" _ (ByVal lpClassName As String, ByVal lpWindowName As String) As Long Private Declare Function GetWindowLong Lib "user32" Alias _ "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" _ (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" _ (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long _ , lParam As Any) As Long Private Sub UserForm_Initialize() Dim hWnd As Long, Style As Long Me.Width = 195.75: Me.Height = 135 '// Affichage sans la barre de titre hWnd = FindWindow(vbNullString, Me.Caption) SetWindowLong hWnd, -16, Style End Sub
Abed_H![]()
Bonsoir,
ça c'est du code !
Epoustouflant
Merci, félicitation Abed_H
Quand j'en serai là !
![]()
Partager