K
kazzy
Hi Excel VBA'ers,
Via Google I found some great code (see below) that enables MouseDown
to paste what's in clipboard. I want this code to apply to ALL of the
textboxes in my Userform. Instead of repeating this code multiple
times for every textbox, I was wondering how/if I can specify multiple
textboxes using the one instance of the code please.
(Hmm, if I'm on the right track, perhaps I have to learn about Class
Modules to do this??)
Here is the code that I found:
Private Sub TextBox1_MouseDown(ByVal Button As Integer, ByVal Shift As
Integer, ByVal X As Single, ByVal Y As Single)
Set doclip = New DataObject
doclip.GetFromClipboard
scode = doclip.GetText
scode = Replace$(scode, Chr$(145), Chr$(39))
scode = Replace$(scode, Chr$(147), Chr$(34))
scode = Replace$(scode, Chr$(148), Chr$(34))
doclip.SetText scode
doclip.PutInClipboard
scode = doclip.GetText
TextBox1 = scode
End Sub
Via Google I found some great code (see below) that enables MouseDown
to paste what's in clipboard. I want this code to apply to ALL of the
textboxes in my Userform. Instead of repeating this code multiple
times for every textbox, I was wondering how/if I can specify multiple
textboxes using the one instance of the code please.
(Hmm, if I'm on the right track, perhaps I have to learn about Class
Modules to do this??)
Here is the code that I found:
Private Sub TextBox1_MouseDown(ByVal Button As Integer, ByVal Shift As
Integer, ByVal X As Single, ByVal Y As Single)
Set doclip = New DataObject
doclip.GetFromClipboard
scode = doclip.GetText
scode = Replace$(scode, Chr$(145), Chr$(39))
scode = Replace$(scode, Chr$(147), Chr$(34))
scode = Replace$(scode, Chr$(148), Chr$(34))
doclip.SetText scode
doclip.PutInClipboard
scode = doclip.GetText
TextBox1 = scode
End Sub