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

MS WORD

    Next

  • 1. Read all lines in document
    Is it possible to loop through an entire word document on a line - by - line basis? If so, how? Thanks, Roger
  • 2. Tables inside paragraph object
    Is there a way of detecting whether a paragraph contains a table?
  • 3. 'AtEndOfDocument' as published does not allways work, some questions.
    The AtEndOfDocument VBA code, as published by Microsoft, does not always work. Function AtEndOfDocument() If Selection.Type = wdSelectionIP And Selection.End = ActiveDocument.Content.End - 1 AtEndOfDocument = True Else AtEndOfDocument = False End If End Function The code above does not work if the last End of Paragraph sign (is that the correct expression??) is selected. The code below works also if the last End of Paragraph sign is selected. Function AtEndOfDocument() If Selection.Type = wdSelectionIP And Selection.End = ActiveDocument.Content.End - 1 Or _ Selection.Type = wdSelectionNormal And Selection.End = ActiveDocument.Content.End Then AtEndOfDocument = True Else AtEndOfDocument = False End If End Function Now to the questions: - Are there any hooks with the improved code? - How come that this trivial issue never (???) has been discussed before? - Why is not AtEndOfDocument a VBA built in function as in Visual Basic?? (OK, silly qustion but ..) Thomas
  • 4. Prevent document AutoOpen.MAIN
    We are using a commercial requirements managment app which includes the ability to import and export word documents. During an export, this app automatically inserts code into the document AutoOpen.MAIN sub. I want to prevent the exported word docs AutoOpen.MAIN sub from executing and instead execute my own custom code on startup. Is their a method to prempt the document AutoOpen.MAIN sub (and disable it?) programmatically? I copied my custom code into the global template AutoOpen.MAIN hoping it would take precedence over the document AutoOpen.MAIN, but that didn't work. Is it possible to somehow only disable the document AutoOpen.MAIN entirely (ActiveX, registry) ? I asked the vendor of the app but they weren't too helpful. Any suggestions will be extremely appreciated.
  • 5. Finding bad formatting
    Dear people, For some time now, I'm struggling to solve a VBA problem Some of you already gave some assistance, for which I'm great full. I'm trying to find some bad formatting in a word document using VBA. On all paragraphs are paragraph styles applied. On pieces of some paragraphs, are Character styles applied. On other pieces of text, other manual formatting is applied like "bold" or "Bold Italic". I'm trying to detect the pieces of text that has no "character style" applied and yet have other manual formatting is applied like "Bold Italic". For example: Some text is set to bold, this is wrong. Other text has the character style "BOLD" applied, this is good. I need to highlight all the bad formatting Can anyone please help me? Thanks JD

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

Postby Philip » Mon, 06 Sep 2004 19:10:35 GMT

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





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

Postby Peter Hewett » Mon, 06 Sep 2004 22:19:17 GMT

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://www.**--****.com/ 

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

HTH + Cheers - Peter


"Philip" < XXXX@XXXXX.COM >, said:



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

Postby Jay Freedman » Mon, 06 Sep 2004 23:25:39 GMT

Hi Philip,

You have a bit of a Catch-22 situation here.

- If you're using the Windows clipboard, it can hold only one item at
a time. Then you have the problem of locating the second item in the
other program before the macro can copy/paste it.

- If you're using the Office clipboard, which is a whole separate
mechanism from the Windows clipboard, you can't do anything with it in
VBA because Microsoft has never provided any automation interface for
it. According to  http://www.**--****.com/ , "There is
no Visual Basic for Applications object model for the Office
Clipboard, so there is no way to programmatically manipulate it."

However, if the other program is an Office program (Excel, Access,
PowerPoint, etc.) then you don't need a clipboard to move data from it
to Word. For example, see
 http://www.**--****.com/ 






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

Postby Philip » Wed, 15 Sep 2004 16:42:42 GMT

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







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

Postby Jay Freedman » Thu, 16 Sep 2004 00:59:45 GMT

Your identical post of 5 September was answered -- twice, on the same day!
If you can't see the replies in the newsgroup through your ISP, they are
archived on Google:
 http://www.**--****.com/ %24t5n%241%40lust.ihug.co.nz

-- 
Regards,
Jay Freedman
Microsoft Word MVP          FAQ:  http://www.**--****.com/ 






Similar Threads:

1.Clear last item copied to the clipboard

Hi,

In searching past questions/answers, I did find this line of code to deal 
with clearing the clipboard, but it doesn't seem to work.  Ideally, I want to 
clear just the last item copied to the clipboard.  Any ideas?  I'm using Word 
XP and 2003.  Thanks much!

CommandBars("Clipboard").Controls("Clear Clipboard").Execute
in English version of Office2000.

2.each time I clear the clipboard the same two items reappear

I can't clear the clipboard. each time the same items reappear.  When I do 
try to paste some text, the entire document inserts itself in a box within 
the document ratehnrt than just the line of text required.

3.Office Clipboard shows icon(s) when first opened, and can't paste XP clipboard contents

Hi,

I'm using Windows XP Home SP2 and Office 2003, a wired keyboard
and using Word 2003 as my email editor.

When I try to copy from the internet and paste into Outlook all I get
is an icon rather than the text/picture I've copied (Ctrl-C) from the
net. This happens everytime if Outlook/Office is closed when I make my
selection. However, if Outlook/Office is open when I make my selection
then the selection pastes as expected. I'm pretty sure this didn't use
to happen, and it doesn't happen when I use Windows 2000 SP4 and 
Office XP/2002 at work. 

Is there an option to allow this, or is it a bug or something that
wipes out the clipboard when I open Office? I would expect that
the XP clipboard is separate from Office and should contain whatever 
I copy under any circumstance. Therefore I have to assume that
Office isn't handling the data from the XP clipboard properly when
opening. When I first open Outlook, if I look in the clipboard I can
see anywhere from 1-4 icons. There's a blue one with a green arroe
like a floopy insert icon, then there are up to 3 other Yellow floppy
icons one with a green checkmark, one with a red cross (X), and one
plain yellow floppy icon. 

I thought I'd read something about the first entry in the Office
clipboard getting mangled or deleted or something when Office opens,
but I can't recall where. Anyway this is really driving me
crazy, if you can help me I'd greatly appreciate it.

Thanks,

Norm

4.Pasting always pastes first clipboard entry, not last

I have a client who is copying and pasting from Word 2003 to another program. 
 The clipboard gathers multiple entries over time, but when he goes to paste 
only the first clipboard entry is pasted, not the most recent.

Anybody know whassup with that?

Thanks!

5.clearing clipboard item through vb(a) code

Hi, i'm looking for code to clear one (office) clipboard item out of many. 
And is it possible to do a copy-paste action without filling the (office) 
clipboard?

thx.

Rob

6. Paste Clipboard from Word to last row in excel

7. shouldn't clipboard clear once I paste?

8. Word Clipboard vs Windows Clipboard



Return to MS WORD

 

Who is online

Users browsing this forum: No registered users and 9 guest