Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Putting a variable value into the Clipboard

I have an Excel macro that reads from several cells and builds them into a
variable. I then want to paste the value of the variable into the Clipboard
so it can be pasted into a text box of another application.

I saw an example in Help that used a DataObject and then used the
PutInClipboard method. This method is not available for a text variable.

What do I have to do to get my text variable into a DataObject. I don't
even know what a DataObject is.

Thanks,

Greg


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Putting a variable value into the Clipboard

Hi Greg,

' DataObject requires as reference in Tools/References to
' Microsoft Forms 2.0 Object Library
' This is added automatically if a Userform has ever existed
' in the project. So, quick way is to add/remove a Userform.
'

Sub test()
Dim dob As DataObject
Set dob = New DataObject

dob.SetText "abc"
dob.PutInClipboard

' now paste into any application

End Sub

Not sure why you write this -
This method is not available for a text variable


Quite the contrary, the DataObject can ONLY accept text

Regards,
Peter T



"Greg de Bruin" wrote in message
...
I have an Excel macro that reads from several cells and builds them into a
variable. I then want to paste the value of the variable into the

Clipboard
so it can be pasted into a text box of another application.

I saw an example in Help that used a DataObject and then used the
PutInClipboard method. This method is not available for a text variable.

What do I have to do to get my text variable into a DataObject. I don't
even know what a DataObject is.

Thanks,

Greg




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Putting a variable value into the Clipboard

Peter,

Thanks very much. You made it easy and now I'm in business.

Greg


"Peter T" <peter_t@discussions wrote in message
...
Hi Greg,

' DataObject requires as reference in Tools/References to
' Microsoft Forms 2.0 Object Library
' This is added automatically if a Userform has ever existed
' in the project. So, quick way is to add/remove a Userform.
'

Sub test()
Dim dob As DataObject
Set dob = New DataObject

dob.SetText "abc"
dob.PutInClipboard

' now paste into any application

End Sub

Not sure why you write this -
This method is not available for a text variable


Quite the contrary, the DataObject can ONLY accept text

Regards,
Peter T



"Greg de Bruin" wrote in message
...
I have an Excel macro that reads from several cells and builds them into
a
variable. I then want to paste the value of the variable into the

Clipboard
so it can be pasted into a text box of another application.

I saw an example in Help that used a DataObject and then used the
PutInClipboard method. This method is not available for a text variable.

What do I have to do to get my text variable into a DataObject. I don't
even know what a DataObject is.

Thanks,

Greg






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
Putting woirksheet name into a variable BZeyger Excel Programming 3 April 17th 07 06:01 PM
Transfer clipboard from Task pane clipboard(office?) content to Excel (windows?) clipboard? tskogstrom Excel Programming 2 March 6th 07 12:50 PM
Putting plain text string into clipboard in VBA? Don Wiss Excel Programming 4 May 22nd 05 10:24 AM
Need to turn off prompt about putting on clipboard or not... KyWilde Excel Discussion (Misc queries) 0 April 27th 05 11:37 PM
Putting an image into the clipboard Jonathan Crow Excel Programming 2 September 12th 03 12:06 AM


All times are GMT +1. The time now is 05:15 AM.

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"