F
Fred
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
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