Using DataObject type for clipboard

T

troubadour

What is wrong with this code ? Thank you
(suggested to me by J.W. at this useful page :
http://www.word.mvps.org/FAQs/MacrosVBA/ManipulateClipboard.htm )

Type DataObject
Toto As Object
End Type
________________________
Sub MyTest()
Dim MyData As DataObject
Dim strClip As String
Set MyData = New DataObject (compiler error here : incorrect use of
the “new†keyword )
MyData.GetFromClipboard
strClip = MyData.GetText
MsgBox (strClip)
End Sub
 
C

CarolineJ

Nothing is wrong with the procedure you just need to remove the TYPE
declaration at the top then it will work great!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top