View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Rob Bovey Rob Bovey is offline
external usenet poster
 
Posts: 811
Default Clipboard.GetText

"Charlie" wrote in message
...
In VB6 I can get the (text) contents of the system clipboard within my app
Debug.Print Clipboard.GetText
I can't seem to do this in VBA. Is there a way to get the clipboard text
into my procedures?


Hi Charlie,

It's a bit more convoluted and not as flexible, but you can do it in VBA
by setting a reference to the Microsoft Forms 2.0 Object Library (which is
set automatically if you add a UserForm to your project) and doing something
like this:

Dim objDataObject As MSForms.DataObject
Set objDataObject = New MSForms.DataObject
objDataObject.GetFromClipboard
Debug.Print objDataObject.GetText

--
Rob Bovey, Excel MVP
Application Professionals
http://www.appspro.com/

* Take your Excel development skills to the next level.
* Professional Excel Development
http://www.appspro.com/Books/Books.htm