PC Review


Reply
Thread Tools Rate Thread

Data type not defined

 
 
K_Macd
Guest
Posts: n/a
 
      9th Jul 2009

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"
 
Reply With Quote
 
 
 
 
Jacob Skaria
Guest
Posts: n/a
 
      9th Jul 2009

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"

 
Reply With Quote
 
K_Macd
Guest
Posts: n/a
 
      9th Jul 2009

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"

 
Reply With Quote
 
Jacob Skaria
Guest
Posts: n/a
 
      9th Jul 2009
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"

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
User defined data type (losing its data) Ludo Microsoft Excel Programming 2 20th May 2009 11:34 AM
User-Defined Data TYPE Ludo Microsoft Excel Discussion 3 17th May 2009 11:47 PM
User Defined Data Type doodle Microsoft Access 4 21st Mar 2007 09:00 AM
User-defined data type; Error: Only User-defined types... =?Utf-8?B?dGlnZXJfUFJN?= Microsoft Excel Programming 1 18th Jul 2004 03:32 PM
User defined data type =?Utf-8?B?YXVndXN0dXMxMDg=?= Microsoft Excel Programming 1 10th Apr 2004 05:11 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:29 AM.