Copying and pasting loses some formatting 
Author Message
 Copying and pasting loses some formatting

(Office XP) When I programmatically copy some text from one document to
another, some of the fonts are both incorrect type and size.  I am trying to
append the contents of one document to the end of another document.

Code snippet:
    Set rngEndOfDoc = m_oDocument.Bookmarks("\EndOfDoc").Range

    rngEndOfDoc.InsertBreak Type:=wdPageBreak
    doc2.Range.FormattedText.Copy
    rngEndOfDoc.Paste

Out of curiousity, I tried doing the same process manually (not in code) and
the same (incorrect) result occurred.  Anyone know what's going on?  Thanks.



Wed, 13 Jul 2005 06:33:20 GMT  
 Copying and pasting loses some formatting
Hi Andrew,

I would expect this to be due to the STYLE formatting applied to the copied
text. If the same style name exists in the target file, then the formatting
definition of the style in the target will take precedence, and the pasted
information will take on the formatting in the target document. Is that what's
happening?

Quote:
> (Office XP) When I programmatically copy some text from one document to
> another, some of the fonts are both incorrect type and size.  I am trying to
> append the contents of one document to the end of another document.

> Code snippet:
>     Set rngEndOfDoc = m_oDocument.Bookmarks("\EndOfDoc").Range

>     rngEndOfDoc.InsertBreak Type:=wdPageBreak
>     doc2.Range.FormattedText.Copy
>     rngEndOfDoc.Paste

> Out of curiousity, I tried doing the same process manually (not in code) and
> the same (incorrect) result occurred.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister
http://www.mvps.org/word
http://go.compuserve.com/MSOfficeForum

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :-)



Fri, 15 Jul 2005 03:41:58 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. RichTextBox <ctrl>V pastes 2 copies, <alt>EP pastes 1 copy

2. losing layout when using copy/paste in vba between 2 documents

3. Tag data gets lost during copy and paste

4. Rich Text Box copy/pasting superscript formatting in VB.NET Std

5. Cut, copy and paste files in VBCFFiles format

6. formatting lost when copying text in Word

7. pasting a word doc into an email without losing paragraphing

8. COPY AND PASTE FROM GLOBAL CLIPBOARD IN VBA

9. Copy, Paste in VB

10. Copy/Paste button

11. Copy Table Records and Paste Append

12. How to Copy and Paste onto Tables Without...

 

 
Powered by phpBB® Forum Software