Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 12-04-2020, 02:42 PM
eduzs eduzs is offline Copying is causing header to be lost Windows 10 Copying is causing header to be lost Office 2019
Expert
Copying is causing header to be lost
 
Join Date: May 2017
Posts: 260
eduzs is on a distinguished road
Default Copying is causing header to be lost

Currently I'm using this code to copy the formatted text from section(x) of one to another document:
Code:
nDoc.Sections(x).Range.Copy
nDoc2.Range.PasteAndFormat wdFormatOriginalFormatting
I have no idea why only when nDoc have more than 2 sections, pasting is causing header of nDoc2 to be deleted, so the code not works as intended.
The solution I thought, if there is no better one, was to copy and paste only the main text region, excluding the header. How to do this?
I appreciate any help.


Thanks
Reply With Quote
  #2  
Old 12-04-2020, 03:44 PM
eduzs eduzs is offline Copying is causing header to be lost Windows 10 Copying is causing header to be lost Office 2019
Expert
Copying is causing header to be lost
 
Join Date: May 2017
Posts: 260
eduzs is on a distinguished road
Default

I found a solution that works fine:
Code:
Set oRng = nDoc.Sections(x).Range
oRng.MoveEnd wdCharacter, -1
oRng.Copy
nDoc2.Range.PasteAndFormat wdFormatOriginalFormatting
Thanks all!
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Deleting rows & pushing them up causing issues ep2002 Excel 2 08-29-2014 02:09 AM
pdfmoutlook add-in causing serious error Jennifer Murphy Outlook 3 01-31-2014 01:26 PM
Copying is causing header to be lost Header/Footer lost with InsertFile cksm4 Word VBA 2 03-07-2011 06:09 PM
Copying is causing header to be lost lost drawing toolbar causing Word to crash manyrains Drawing and Graphics 1 11-07-2009 12:27 AM
Lost Column header Policy Peddler Outlook 1 06-05-2009 07:57 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 01:48 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft