Minimiser un userform

Boostez vos compétences Excel avec notre communauté !

Rejoignez Excel Downloads, le rendez-vous des passionnés où l'entraide fait la force. Apprenez, échangez, progressez – et tout ça gratuitement ! 👉 Inscrivez-vous maintenant !

bernardrustrel

XLDnaute Occasionnel
Bonsoir
Sur le fichier joint j'ai réussi en m'aidant du net à mettre le boutons= "reduction" du userform et à l'utiliser.
Cependant, j'aimerais pouvoir minimiser mon userform en actionnant le bouton "test".
Si l'un de vous avait une idée je l'en remercie par avance.
Cordialement
bernard
 

Pièces jointes

Re : Minimiser un userform

Bonjour, salut Roland,
au regard de ton exemple le code peut éventuellement être simplifié (mais je ne connais pas l'intégralité de ton fichier réel) :
Code:
Private Declare Function FindWindowA& Lib "User32" (ByVal lpClassName$, ByVal lpWindowName$)
Private Declare Function GetWindowLongA& Lib "User32" (ByVal Hwnd&, ByVal nIndex&)
Private Declare Function SetWindowLongA& Lib "User32" (ByVal Hwnd&, ByVal nIndex&, ByVal dwNewLong&)
Private Declare Function ShowWindow& Lib "User32" (ByVal Hwnd&, ByVal nCmdShow&)

Dim Hwnd As Long

Private Sub CommandButton1_Click()
'minimise par bouton
    ShowWindow Hwnd, 2
End Sub

Private Sub UserForm_Initialize()
'Initialisation du bouton minimiser
    Hwnd = FindWindowA(vbNullString, Me.Caption)
    SetWindowLongA Hwnd, -16, GetWindowLongA(Hwnd, -16) Or &H20000
End Sub
A+
 
- Navigue sans publicité
- Accède à Cléa, notre assistante IA experte Excel... et pas que...
- Profite de fonctionnalités exclusives
Ton soutien permet à Excel Downloads de rester 100% gratuit et de continuer à rassembler les passionnés d'Excel.
Je deviens Supporter XLD

Discussions similaires

Réponses
2
Affichages
521
Retour