HTSCF Fareha
11-26-2021, 04:16 AM
As kindly provided by Graham Mayor on a separate thread, I've been using the following attached to enable right mouse click pasting into a TextBox, using the below Sub to enable pasting, in this case, into the TextBox labelled txtEditor.
Private Sub txtEditor_MouseDown(ByVal Button As Integer, _
ByVal Shift As Integer, _
ByVal x As Single, _
ByVal y As Single)
' If right-button clicked
If Button = 2 Then
Call ShowPopup(Me, Caption, txtEditor, x, y)
End If
lbl_Exit:
Exit Sub
End Sub
This works brilliantly on a single Textbox, but I was wondering how one would be able to utilize it for more than one TextBox on the same UserForm. I can add multiple Subs and changing the Sub name and related TextBox name, but was wondering if there was a more efficient way?
Private Sub txtEditor_MouseDown(ByVal Button As Integer, _
ByVal Shift As Integer, _
ByVal x As Single, _
ByVal y As Single)
' If right-button clicked
If Button = 2 Then
Call ShowPopup(Me, Caption, txtEditor, x, y)
End If
lbl_Exit:
Exit Sub
End Sub
This works brilliantly on a single Textbox, but I was wondering how one would be able to utilize it for more than one TextBox on the same UserForm. I can add multiple Subs and changing the Sub name and related TextBox name, but was wondering if there was a more efficient way?