Fred Wayne
Member
Hello,
I am practicing and trying to learn from your forum every day. My situation is the following: I made a simple userform. I have managed to find the way to copy the captions from the CommandButton to the Clipboard and then that caption be pasted somewhere else. What I want is copy the caption of that CommandButton straight to the TextBox. I mean...once I click the CommandButton, that information to be automatically pasted in the TextBox.
Above I put the code that I am using to copy the CommandButton Captions in the Clipboard, but how can I make what is copied in the clipboard to be automatically pasted in the TextBox when clicking on the CommandButton?
Always so thankful for your teaching and great efforts you do for us to learn.
Thank you so much.
I am practicing and trying to learn from your forum every day. My situation is the following: I made a simple userform. I have managed to find the way to copy the captions from the CommandButton to the Clipboard and then that caption be pasted somewhere else. What I want is copy the caption of that CommandButton straight to the TextBox. I mean...once I click the CommandButton, that information to be automatically pasted in the TextBox.
Code:
Private Sub CommandButton1_Click()
Dim MyData As New DataObject
MyData.SetText "Apples: "
MyData.PutInClipboard
End Sub
Private Sub CommandButton2_Click()
Dim MyData As New DataObject
MyData.SetText "Tomatoes: "
MyData.PutInClipboard
End Sub
Private Sub CommandButton3_Click()
Dim MyData As New DataObject
MyData.SetText "Radish: "
MyData.PutInClipboard
End Sub
Above I put the code that I am using to copy the CommandButton Captions in the Clipboard, but how can I make what is copied in the clipboard to be automatically pasted in the TextBox when clicking on the CommandButton?
Always so thankful for your teaching and great efforts you do for us to learn.
Thank you so much.