ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Data type not defined (https://www.excelbanter.com/excel-programming/430890-data-type-not-defined.html)

K_Macd

Data type not defined
 

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

--
Ken
"Started with Visicalc in 82"

Jacob Skaria

Data type not defined
 

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
---------------
Jacob Skaria


"K_Macd" wrote:

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

--
Ken
"Started with Visicalc in 82"


K_Macd

Data type not defined
 

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

Dim MyData as DataObject
MyData.GetFromClipboard
Text = MyData.GetText(1)

_ 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

--
Ken
"Started with Visicalc in 82"


"Jacob Skaria" wrote:

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
---------------
Jacob Skaria


"K_Macd" wrote:

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

--
Ken
"Started with Visicalc in 82"


Jacob Skaria

Data type not defined
 
Refer

http://www.cpearson.com/excel/Clipboard.aspx

If this post helps click Yes
---------------
Jacob Skaria


"K_Macd" wrote:

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

Dim MyData as DataObject
MyData.GetFromClipboard
Text = MyData.GetText(1)

_ 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

--
Ken
"Started with Visicalc in 82"


"Jacob Skaria" wrote:

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
---------------
Jacob Skaria


"K_Macd" wrote:

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

--
Ken
"Started with Visicalc in 82"



All times are GMT +1. The time now is 12:42 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com