Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 703
Default 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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default 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



  #3   Report Post  
Posted to microsoft.public.excel.programming
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


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 703
Default 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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Where does Ms XL store the clipboard ? or where does MS Windowsstore clipboard ? Subu Setting up and Configuration of Excel 1 May 18th 09 06:56 AM
Where does Ms XL store the clipboard ? or where does MS Windowsstore clipboard ? Subu Setting up and Configuration of Excel 0 May 5th 09 01:20 PM
Clipboard empty but still get waring that clipboard is full Steve Excel Discussion (Misc queries) 0 June 17th 08 09:05 PM
How to GetText() from TextBox under Visual C++ application? Danil Excel Worksheet Functions 0 August 31st 07 11:38 AM
Clipboard George New Users to Excel 1 April 13th 06 10:01 AM


All times are GMT +1. The time now is 06:39 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"