'How to copy text contained in a cell to clipboard
I'm very new to this, so please bear with me. Background info: I'm trying to create my own quickparts / textblock tool so to speak. In order to achieve this I have created multiple "buttons" that i want to assign to macros. The desired result is, that you only have to click the button (named "holidays" for instance) and the corresponding explanatory text is copied into your clipboard. The problem is that the corresponding text passages are often long and I don't want them included in the code as is the case at the moment where I use this:
Sub Holidays()
Dim obj As New DataObject
Dim txt As String
txt = "Holidays must be requested minimum 2 weeks prior"
obj.SetText txt
obj.PutInClipboard
Beep
End Sub
Instead of having the explanatory text in the code I would like to have it stored in a cell in a different sheet and it to be accessed and copied into the clipboard. What I have tried so far is putting the text in a cell and named it [Holidays]. I can also set it as a message box, but can't seem to figure out how to get it into the clipboard. Can anyone help me out with this?
Thanks a lot!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
