Results 1 to 6 of 6
  1. #1
    2 Star Lounger
    Join Date
    Dec 2007
    Posts
    171
    Thanks
    3
    Thanked 0 Times in 0 Posts
    Hi all,

    Word 2003 (+2007?)VBA: How to program the Clipboard pane

    In a VBA package I have built I needed to use Copy and Paste, which use the Word clipboard. While testing my package I then noticed that if I had performed a 'Copy command (intending to then later do a Paste) before using one of my VBA operations, then after, it is cleared from the clipboard and so no longer available for Paste. After using my VBA package ops, I would like to be able to restore the original clipboard contents.

    I have noticed that in Word 2003 there is a Clipboard pane into which I can copy as many items as I wish. Then I can select whichever one I want and paste it. This would solve the issue, but I can't find the VBA interface for accessing the items in the Clipboard pane. Can anybody tell me?

    TIA

    avi

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 18 Times in 18 Posts
    As far as I know, the Office clipboard is not accessible in the VBA object model.

    You can manipulate the Windows clipboard using the DataObject available in the Microsoft Forms 2.0 Object Library - see Windows Clipboard.

  3. #3
    2 Star Lounger
    Join Date
    Dec 2007
    Posts
    171
    Thanks
    3
    Thanked 0 Times in 0 Posts
    [quote name='HansV' post='782457' date='30-Jun-2009 16:06']As far as I know, the Office clipboard is not accessible in the VBA object model.

    You can manipulate the Windows clipboard using the DataObject available in the Microsoft Forms 2.0 Object Library - see Windows Clipboard.[/quote]

    Can you put in the Windows clipboard all the Word formatting data information in order to copy a block of content formatted in Word?

    avi

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 18 Times in 18 Posts
    No, unfortunately not, but you could use the DataObject to hold a text item while copying other items to and from the Windows clipboard (using Word's Copy and Paste methods).

  5. #5
    2 Star Lounger
    Join Date
    Dec 2007
    Posts
    171
    Thanks
    3
    Thanked 0 Times in 0 Posts
    [quote name='HansV' post='782461' date='30-Jun-2009 16:38']No, unfortunately not, but you could use the DataObject to hold a text item while copying other items to and from the Windows clipboard (using Word's Copy and Paste methods).[/quote]

    But font names, sizes and colors ARE copied...

    But that is not the same things as Word information e.g., Style names.

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 18 Times in 18 Posts
    If necessary, you could create a new Word document in code, paste there, and later on copy the contents to the clipboard again and discard the document.

Posting Permissions

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