D dodineau XLDnaute Occasionnel 4 Juillet 2019 #1 Bonjour, Connaissez vous une commande VBA pour bloquer le déplacement d'un userform ? Merci.
Temjeh XLDnaute Accro Supporter XLD 4 Juillet 2019 #2 Bonjour dodineau, mapomme Une variante qui aussi le centre (sans déclaration de variables!) VB: Private Sub UserForm_Initialize() LargeurFenêtre = Application.Width HauteurFenêtre = Application.Height PositionGauche = Application.Left PoisitionHaut = Application.Top Me.Left = (PositionGauche + LargeurFenêtre) - ((LargeurFenêtre + Me.Width) / 2) Me.Top = (PoisitionHaut + (HauteurFenêtre / 2)) - Me.Height / 2 End Sub Private Sub UserForm_Layout() LargeurFenêtre = Application.Width HauteurFenêtre = Application.Height PositionGauche = Application.Left PoisitionHaut = Application.Top Me.Left = (PositionGauche + LargeurFenêtre) - ((LargeurFenêtre + Me.Width) / 2) Me.Top = (PoisitionHaut + (HauteurFenêtre / 2)) - Me.Height / 2 End Sub Vote positif 0 Vote négatif
Bonjour dodineau, mapomme Une variante qui aussi le centre (sans déclaration de variables!) VB: Private Sub UserForm_Initialize() LargeurFenêtre = Application.Width HauteurFenêtre = Application.Height PositionGauche = Application.Left PoisitionHaut = Application.Top Me.Left = (PositionGauche + LargeurFenêtre) - ((LargeurFenêtre + Me.Width) / 2) Me.Top = (PoisitionHaut + (HauteurFenêtre / 2)) - Me.Height / 2 End Sub Private Sub UserForm_Layout() LargeurFenêtre = Application.Width HauteurFenêtre = Application.Height PositionGauche = Application.Left PoisitionHaut = Application.Top Me.Left = (PositionGauche + LargeurFenêtre) - ((LargeurFenêtre + Me.Width) / 2) Me.Top = (PoisitionHaut + (HauteurFenêtre / 2)) - Me.Height / 2 End Sub
Usine à gaz XLDnaute Barbatruc Supporter XLD 4 Juillet 2019 #3 Bonjour, Ce fichier concocté par l'un des ténors du site pourrait peut-être convenir ? Amicalement, Lionel, Pièces jointes position combobox.xlsm 24.7 KB · Affichages: 18 Vote positif 0 Vote négatif
Bonjour, Ce fichier concocté par l'un des ténors du site pourrait peut-être convenir ? Amicalement, Lionel,
mapomme XLDnaute Barbatruc Supporter XLD 4 Juillet 2019 #4 Bonsoir @dodineau, @Temjeh, @arthour973, Une nouvelle version testée cette fois ci : VB: Option Explicit Dim TopInit, LeftInit Private Sub UserForm_Initialize() TopInit = "x" End Sub Private Sub UserForm_Layout() If TopInit = "x" Then TopInit = Me.Top: LeftInit = Me.Left Me.Move LeftInit, TopInit End Sub Pièces jointes dodineau- USF Pas bouger- v1a.xlsm 18.2 KB · Affichages: 17 Dernière édition: 4 Juillet 2019 Vote positif 0 Vote négatif
Bonsoir @dodineau, @Temjeh, @arthour973, Une nouvelle version testée cette fois ci : VB: Option Explicit Dim TopInit, LeftInit Private Sub UserForm_Initialize() TopInit = "x" End Sub Private Sub UserForm_Layout() If TopInit = "x" Then TopInit = Me.Top: LeftInit = Me.Left Me.Move LeftInit, TopInit End Sub
D dodineau XLDnaute Occasionnel 10 Juillet 2019 #5 Bonjour et merci pour votre aide. Ca fonctionne comme je le voulais. A+ Vote positif 0 Vote négatif