![]() |
Clipboard.GetText
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? Thanks |
Clipboard.GetText
Charlie,
Set a reference to the MSForms 2.0 library, and use code like the following: Dim DObj As MSForms.DataObject Dim S As String Set DObj = New MSForms.DataObject DObj.GetFromClipboard S = DObj.GetText Debug.Print S -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "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? Thanks |
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 |
Clipboard.GetText
Thanks to both of you!
"Rob Bovey" wrote: "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 |
All times are GMT +1. The time now is 05:27 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com