I'm using a method widely promoted on the web to copy to the clipboard to post a string to the clipboard generated from data in the active worksheet so that I can paste it into another application. I've activated MicrosoftForms 2.0 ObjectLibrary in Tools/References to no effect even after restarting Excel.
This is the essence of my code in Excel 2019 under Win10 Pro. Running it just generates two ASCII 63 characters on the clipboard. Feeding text from a string variable generates the same result. Inspecting the object reveals no content.
Sub clipboardTest()
Dim MSForms_DataObject As Object
Set MSForms_DataObject = CreateObject("new:{1C3B4210-F441-11CE-B9EA-00AA006B1A69}")
MSForms_DataObject.SetText "Just testing"
MSForms_DataObject.PutInClipboard
Set MSForms_DataObject = Nothing
End Sub
Where am I going wrong and what should I do about it?
BTW, ideally I'd like to store the macro in my Personal Macro workbook rather than in individual workbooks if that makes any difference.
Thanks for any help.
This is the essence of my code in Excel 2019 under Win10 Pro. Running it just generates two ASCII 63 characters on the clipboard. Feeding text from a string variable generates the same result. Inspecting the object reveals no content.
Sub clipboardTest()
Dim MSForms_DataObject As Object
Set MSForms_DataObject = CreateObject("new:{1C3B4210-F441-11CE-B9EA-00AA006B1A69}")
MSForms_DataObject.SetText "Just testing"
MSForms_DataObject.PutInClipboard
Set MSForms_DataObject = Nothing
End Sub
Where am I going wrong and what should I do about it?
BTW, ideally I'd like to store the macro in my Personal Macro workbook rather than in individual workbooks if that makes any difference.
Thanks for any help.