1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
   | Dim var
Private Sub ListBox1_MouseUp(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
    var = ListBox1.List(ListBox1.ListIndex, 0)
End Sub
 
Private Sub TextBox1_MouseUp(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
    With TextBox1
        pos = .SelStart
        If pos = 0 And TextBox1.Value = "" Then
            TextBox1 = var
        Else
            .Value = Mid(.Value, 1, pos) & var & Mid(.Value, pos + 1)
        End If
    End With
End Sub
Private Sub UserForm_Activate()
    ListBox1.List = Array("toto", "titi", "riri", "fifi", "loulou")
End Sub | 
Partager