Results 1 to 3 of 3
  1. #1
    Star Lounger
    Join Date
    Mar 2001
    Location
    Atlanta, Georgia, USA
    Posts
    64
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Problems using Clipboard (Office 2000 SR1)

    I am trying to read the clipboard in Word VBA, but I'm not meeting with much success. I found this snippet on the MVP site:

    Dim MyData As DataObject
    Dim strClip As String

    Set MyData = New DataObject
    MyData.GetFromClipboard
    strClip = MyData.GetText

    But when I try it, I get the error "User Defined Type not Defined" on the Dim of MyData. Have I forgotten to install something? Relatively new system, running Windows NT4, SP6a, with the entire Office suite. I've also installed VB6.

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Problems using Clipboard (Office 2000 SR1)

    Need to set a reference to the Microsoft Forms 2.0 Object Library. If it isn't on the list, insert a UserForm into your project. After that, you can remove the UserForm and the library should stay.

  3. #3
    Platinum Lounger
    Join Date
    Dec 2000
    Location
    Queanbeyan, New South Wales, Australia
    Posts
    3,730
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Problems using Clipboard (Office 2000 SR1)

    What do you want to do with the clipboard?

    If you want to insert text into your document, "Selection.Paste" (or even better, use the Range object) will do the job.

    But many people use the clipboard (especially when copying from one Word document to another) when that is a very inefficient method. For Word to Word, there's much better ways. Ask if that's what you're trying to do.
    Subway Belconnen- home of the Signboard to make you smile. Get (almost) daily updates- follow SubwayBelconnen on Twitter.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •