I'm currently looking for a methode to copy a 1D array to clipboard by using excel vba. So far, I already fail by copying only one string to the clipboard. What I did is:
First: I included the "Microsoft Forms 2.0 Object Library" to my project
Second: I tried to copy the strText string to the clipboard by using the following code.
Sub copyToClipboard()
Dim objData As New MSForms.DataObject
strText= "1"
objData.SetText strText
objData.PutInClipboard
objData.GetFromClipboard
resultString = objData.GetText
End Sub
If I paste the clipboard to a text Editor I get some funny symbols. If I check the content of resultString, I get "??".
EDIT: As mentionded below, I only get the "??" if I debug the code. A normal run is giving the expected output. Here is an image of the output window
The second output line is while debuging the code, the first one is a normal run.