• Problems using Clipboard (Office 2000 SR1)

    Home » Forums » AskWoody support » Productivity software by function » MS Word and word processing help » Problems using Clipboard (Office 2000 SR1)

    Author
    Topic
    #374776

    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.

    Viewing 1 reply thread
    Author
    Replies
    • #607575

      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.

    • #607647

      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.

    Viewing 1 reply thread
    Reply To: Problems using Clipboard (Office 2000 SR1)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: