Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Putting woirksheet name into a variable | Excel Programming | |||
Transfer clipboard from Task pane clipboard(office?) content to Excel (windows?) clipboard? | Excel Programming | |||
Putting plain text string into clipboard in VBA? | Excel Programming | |||
Need to turn off prompt about putting on clipboard or not... | Excel Discussion (Misc queries) | |||
Putting an image into the clipboard | Excel Programming |