Const petit = 450 'petite largeur de l'USF, à adapter
Const grand = 552 'grande largeur de l'USF, à adapter
Private Sub OkButton_Click()
'Me.Width = petit 'inutile
End Sub
Private Sub CancelButton_Click()
Unload Me
End Sub
Private Sub TextBox1_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
If Button = 2 Then ComboBox1.DropDown: Me.Width = grand
End Sub
Private Sub ComboBox1_Change()
Dim n%
n = ComboBox1.ListIndex
If n = -1 Then Exit Sub
ComboBox1 = ""
TextBox1.SetFocus
CreateObject("WScript.Shell").SendKeys IIf(n = 0, "^x", IIf(n = 1, "^c", "^v")) 'envoi les touches
End Sub
Private Sub ComboBox1_DropButtonClick() 'quand la liste se déroule ou se ferme
Me.Width = petit
End Sub
Private Sub UserForm_Initialize()
ComboBox1.List = [{"Couper","Ctrl+X";"Copier","Ctrl+C";"Coller","Ctrl+V"}]
ComboBox1.Top = TextBox1.Top - ComboBox1.Height
With Label1
.BackColor = Me.BackColor
.Top = 0
.Height = ComboBox1.Top + ComboBox1.Height 'masque la partie visible de la zone de restitution
.Left = ComboBox1.Left
.Width = ComboBox1.Width
End With
Me.Width = petit
End Sub