LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 73
Default Using a custom format on the clipboard

I want to put some data on the clipboard and retreive it but using a custom
format.
I tried the code below. I run myCopy and it works fine but myPaste fails
when trying to retreive the data (myStr = myDataObj.GetText("myFormat"))
with the error message:
Dataobject: Gettext invalid FORMATETC structure.

Can someone help me make this work. I want to use a custom format because I
also want to keep some standard text data in the clipboard.

Thanks
Fred


Sub myCopy()
Dim myDataObj As DataObject

Set myDataObj = New DataObject
myDataObj.SetText Selection.Cells(1).Value, "myFormat"
myDataObj.PutInClipboard
Set myDataObj = Nothing
End Sub

Sub myPaste()
Dim myStr As String
Dim myDataObj As DataObject

Set myDataObj = New DataObject
myDataObj.GetFromClipboard
myStr = myDataObj.GetText("myFormat")
MsgBox myStr
Set myDataObj = Nothing
End Sub



 
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
clipboard and format painter abkad Excel Discussion (Misc queries) 1 June 16th 09 10:37 AM
Format Cell as custom type but data doesn't display like I custom. ToMMie Excel Discussion (Misc queries) 6 September 11th 08 08:31 AM
Custom face on a button without using clipboard? Nigel Excel Programming 3 October 15th 04 01:07 PM
Custom face on a button without clipboard? Nigel Excel Programming 3 October 15th 04 01:01 PM
Custom button face without clipboard? Nigel Excel Programming 2 October 15th 04 12:46 PM


All times are GMT +1. The time now is 06:30 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"