rjplante
Well-known Member
- Joined
- Oct 31, 2008
- Messages
- 574
- Office Version
- 365
- Platform
- Windows
I have a userform that displays a large block of text that I have entered into a label. I would like to have a command button to copy the text and close the user form so that the user can paste the text into a cell or another document. Here is what I have so far, which is currently not working.
Any suggestions on what I can do to get this to work would be great.
VBA Code:
Private Sub CommandButton2_Click()
Dim MyData As DataObject
Set MyData = New DataObject
MyData.SetText Label1.Caption
MyData.PutInClipboard
UserForm5.Hide
End Sub
Any suggestions on what I can do to get this to work would be great.