+ Reply to Thread
Results 1 to 2 of 2

Bizarre Header Copy Paste Issue

  1. #1
    Registered User
    Join Date
    09-10-2019
    Location
    Colorado
    MS-Off Ver
    Office 2016
    Posts
    1

    Bizarre Header Copy Paste Issue

    Hello,

    I'm writing a sub that will merge word docs without changing any formatting. It is working perfectly for the body of the paper, and the footer is the same in all of the documents so no issues there. The headers change in each document, all of them being of the primary type because each page of each document has the same header (they are basically chapters of a document that were written by different individuals and the client wants a copy of all of them together in a single docx file). I have the code look at the page and section count in each document and select the last n pages of the original doc, right after pasting the WholeStory in. I then make a Copy of the HeaderFooter, go to the combined doc to be added to, select the last n pages, unlink to previous all headers and copy paste in the header onto those n pages. In a 20 document merge, 15 of them are behaving exactly as I want them to. The puzzling thing is that some of the docs are expanding the header paste into the previous section even though it is outside the selected page range. I suspect it has something to do with my sections count but sections (long) isn't explained well in Microsoft's word VBA documentation and most of my VBA experience is in excel. One solution I tried was to have a continuous section break followed by a full section break after each chapter is added. I also tried reducing the number of selected pages in each pasted doc, and it changed nothing and resulted in a mess in the headers that were working. I also did step-throughs and message boxes to try to debug it. Do you have any ideas about what I did wrong here? Thanks! (Unfortunately I can't share the code due to my noob status).

  2. #2
    Forum Expert macropod's Avatar
    Join Date
    12-22-2011
    Location
    Canberra, Australia
    MS-Off Ver
    Word, Excel & Powerpoint 2003 & 2010
    Posts
    3,160

    Re: Bizarre Header Copy Paste Issue

    See: https://www.msofficeforums.com/word-...documents.html
    Cheers,
    Paul Edstein
    [MS MVP - Word]

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1