Results 1 to 3 of 3
  1. #1
    New Lounger
    Join Date
    Mar 2002
    Location
    Paisley, Scotland
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Word 2000 Clipboard (9.0.3821/SR-1)

    I'm new to Microsoft Office and VBA, and therefore took up a training course on the same.
    Without being too verbose this is the outline detail of my problem:-

    1. I have created a Word 2000 template and placed a user_form on same. On this form I have a command button which copies text to the clipboard. If I attempt to paste this into Excel 2000, Excel justs hangs until I close my Word VBA program whereupon it pastes the result immediately my program ends.

    2. If I paste to Wordpad or any other application that is not part Of Microsoft Office this works ok.

    3. If I open my Word 2000 template in Word 97 and copy to clipboard I am able to paste into Excel 2000 with no problems.

    I have attempted to find an answer on Microsofts Knowledge database, but have found no solution.

    Was the Clipboard interface changed at release 2000 of Office? If so is there a workaround?

    Any Ideas?

  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: Word 2000 Clipboard (9.0.3821/SR-1)

    The clipboard was changed in a big way: it holds up to 12 items for Office apps. I'm not sure VBA is equipped to deal with that wrinkle, but I haven't dug into it.

    On the other hand, there probably is a way to pop the info into the clipboard and then immediately release the object before you try to paste it into Excel. Can you post the code? Perhaps we can see a reason that Word is maintaining control of the clipboard for longer than necessary.

  3. #3
    New Lounger
    Join Date
    Mar 2002
    Location
    Paisley, Scotland
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Word 2000 Clipboard (9.0.3821/SR-1)

    Hi Jefferson,

    Many thanks for your prompt response.

    The clip code I am using is as follows:-

    Private Sub cmdClip_Click()
    ' Copy RGB Hex value to clipboard
    Dim mydata1 As DataObject
    Dim strClip As String
    strClip = txtHexVal.Text
    Set mydata1 = New DataObject
    ' Clear the ClipBoard
    mydata1.SetText ""
    mydata1.PutInClipboard
    ' Copy RGB Hex value to clipboard
    mydata1.SetText strClip
    mydata1.PutInClipboard
    'The following achieves the same result as above
    'txtHexVal.SelStart = 0
    'txtHexVal.SelLength = txtHexVal.TextLength
    'txtHexVal.Copy
    End Sub

    For further info, I have attached the Total VBA code in the form of a zip file.

    Regards

    Rodopi.
    Attached Files Attached Files

Posting Permissions

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