Ich brauche kurz Eure Hilfe.
Ich möchte mit der rechten Maustaste aus einer TextBox den Text kopieren.
Könnt ihr mir Helfen, wie hier der Quellcode dazu lautet?
Vielen Dank
Private Sub TextBox1_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As _
Single, ByVal Y As Single)
Dim objClipboard As Object
If Button = 2 Then
Set objClipboard = CreateObject("new:{1C3B4210-F441-11CE-B9EA-00AA006B1A69}")
With objClipboard
.SetText TextBox1.Value
.PutInClipboard
End With
Set objClipboard = Nothing
End If
End Sub
Viele Grüße
Private Sub TextBox1_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As _
Single, ByVal Y As Single)
Dim objClipboard As Object
If TextBox1 = Empty Then Exit Sub
If Button = 2 Then
Set objClipboard = CreateObject("new:{1C3B4210-F441-11CE-B9EA-00AA006B1A69}")
With objClipboard
.SetText TextBox1.Value
.PutInClipboard
End With
Set objClipboard = Nothing
End If
End Sub
Viele Grüße
Option Explicit
Private Sub TextBox2_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As _
Single, ByVal Y As Single)
If Button = 2 Then
With TextBox2
.SelStart = 0
.SelLength = Len(.Text)
.Copy
.SelStart = Len(.Text) ' 0 dann ist der Cursor am Anfang bzw. ohne diese Zeile _
bleibt der Text markiert
End With
End If
End Sub
Servus