Re: Clipboard: pasting last two (or all) items from Word clipboard and clearing clipboard.

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Peter Hewett (nospam_at_xtra.co.nz)
Date: 09/05/04


Date: Mon, 06 Sep 2004 01:19:17 +1200

Hi Philip

I'm afraid you're out of luck. Although you can copy ann paste multiple pieces of data
within Office applications you can't do it either from another application or
programmatically from within Office. There are in fact two clipboards the general one
shared by all applications which holds just one piece of data and a clipboard private to
the Office applications which can hold multiple items of data. Unfortunately Microsoft
did not bother to expose an API for the Office clipboard so you can't use it from VBA
etc..

You will need to restructure your requirements to do two cut/copy and pastes.

You can find help on working with the clipboard here:

Manipulating the clipboard using VBA
http://word.mvps.org/faqs/macrosvba/ManipulateClipboard.htm

Of you still need help after reading this article post again.

HTH + Cheers - Peter

"Philip" <finton@ihug.co.nz>, said:

>I copy two pices of text from another program and need some VBA way of
>1 pasting them into Word in the order copied, then clearing the
>Clipboard,
>2 adding various other stuff below the pastes (have macro for this),
>3 manually entering three bits of text in separate positions in the table
>formed by (2),
>4 format the text, and print the page (have another macro for this).
>
>What I'd like to do is combine the lot into one macro. I think I know how to
>do (3) [but suggestions welcome!], but how do I do (1)??? It is not
>something I can macro record.
>The pastes contain different info but are always the same number of lines
>and the manually typed stuff varies but is always in the same places.
>
>Philip
>
>
>



Relevant Pages

  • Re: Selecting text in a macro
    ... This pastes the contents of the clipboard and selects the pasted text. ... can then format it how you wish. ... After a bit of guesswork, I worked out how to put this into a macro, and it ...
    (microsoft.public.word.vba.general)
  • RE: Keyboard command to clear clipboard
    ... Its for recording a macro that for whatever reason when you run it, ... have something else on the clipboard it pastes that instead of what its ... if I can run the keyboard command to clear the clipboard ...
    (microsoft.public.windowsxp.general)
  • Re: FileSaveAs Wont Work In Macro
    ... > creates a new blank document, pastes the clipboard contents ... > with the same name as what the macro recorded. ... > imported by Quark without any scrambling, garbage styles, etc. ...
    (microsoft.public.mac.office.word)
  • Re: Macro retrieves text that was copied or cut
    ... you recorded a macro that pastes the contents of the clipboard: ... it does exactly that -- pastes whatever you last copied. ... ie to keep the original macro as it was. ...
    (microsoft.public.word.docmanagement)
  • Temp user directory
    ... I copy html source code to the clipboard (from within David Baldwin's ... MS Office applications paste this very nicely, pictures ...
    (comp.lang.pascal.delphi.misc)