Data type not defined

K

K_Macd

The following code comes from excel 2007 help

Dim MyData as DataObject

Private Sub CommandButton1_Click()
'Need to select text before copying it to Clipboard
TextBox1.SelStart = 0
TextBox1.SelLength = TextBox1.TextLength
TextBox1.Copy

MyData.GetFromClipboard
TextBox2.Text = MyData.GetText(1)
End Sub

Private Sub UserForm_Initialize()
Set MyData = New DataObject
TextBox1.Text = "Move this data to the " _
& "Clipboard, to a DataObject, then to "
& "TextBox2!"
End Sub

The macro fails on the DIM statement indicating that it cannot find that
data type. Is this a non-standard data type or does it originate from other
add-ons

TIA for any clues on building/finding it
 
J

Jacob Skaria

You would have tried pasting the code in one of the modules..Within VBE from
the left tree view; right click MicrosoftExcelObject and Insert a Userform.
Then from the toolbox drag two textbox controls and a command button control.
Right click on the icon userform1 and view code..and then paste the code and
try

PS: This will reference to MicrosoftForms x.0 Object library...

If this post helps click Yes
 
K

K_Macd

The code was just a wider example - what I was trying to achieve is test for
an empty/filled clipboard and had hoped to use the following elements
_ TestClip = IIf(IsEmpty(Text), False, True)

Is DataObject a data type that only accompanies a User Form or is there
another way to interegate the clipboard? I also suspect that GetFromClipboard
may be a method that is not available outside the form container

Thanks
 

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