Solved

Combining Word documents with different margins, headers and footers etc into 1 document

Posted on 2009-04-04
5
818 Views
Last Modified: 2013-11-05
Hi guys,

I'm having some trouble combining Word documents. I know there are a lot of solutions around for combining documents, but mine contain different margins, headers and footers and general page setups.

If anyone has any ideas as to how to combine lots of very differently formatted docs into 1 master document that'd be great!

Cheers,

Bob
0
Comment
Question by:Bobeo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 1

Expert Comment

by:tinawin
ID: 24068537
Hey Bob,

What version of Word are you using. Do you know that Word uses section breaks so that margins, header and footer can be different in each section?
0
 
LVL 3

Author Comment

by:Bobeo
ID: 24068553
Hey Tinawin,

I personally am using 2007, but the process will be used by the public so it needs to work on anything from 2000 and above really.

I was aware of the section break method, but can't find a way to automate the process of taking the margins and headers from each file and applying them to the master one.
0
 
LVL 1

Accepted Solution

by:
tinawin earned 500 total points
ID: 24068732
Bobeo,

Before combining the files I change Word's view to outline, inserted the files, then change back to print layout view. Margins, Header and Footer didn't change. Below is the macro I recorded maybe this can help with the automation.

Sub insertMaster()
'
' insertMaster Macro
'
'
    ActiveWindow.ActivePane.View.Type = wdOutlineView
    If ActiveWindow.View = wdMasterView Then
        ActiveWindow.View = wdOutlineView
    Else
        ActiveWindow.View = wdMasterView
    End If
    Selection.Range.Subdocuments.AddFromFile Name:="Narrow Margins.docx", _
        ConfirmConversions:=False, ReadOnly:=False, PasswordDocument:="", _
        PasswordTemplate:="", Revert:=False, WritePasswordDocument:="", _
        WritePasswordTemplate:=""
    Selection.Range.Subdocuments.AddFromFile Name:="t Life is wonderful.docx", _
         ConfirmConversions:=False, ReadOnly:=False, PasswordDocument:="", _
        PasswordTemplate:="", Revert:=False, WritePasswordDocument:="", _
        WritePasswordTemplate:=""
    WordBasic.ViewPageFromOutline
0
 
LVL 4

Expert Comment

by:Xcone
ID: 24071851
You can also use the clipboard. It's not neat, but it works. Below is a macro which will use the clipboard to paste a second document below the first.
Public Sub MergeDocs(ByVal ATargetDocument As Document, ByVal ASoureDocument As Document)
  Dim r As Range
  
  Set r = ATargetDocument.Range
  r.Collapse wdCollapseEnd
  ATargetDocument.Sections.Add r, WdSectionStart.wdSectionNewPage
  
  ASoureDocument.Range.Copy
  
  Set r = ATargetDocument.Range
  r.Collapse wdCollapseEnd
  r.Paste
End Sub

Open in new window

0
 
LVL 3

Author Comment

by:Bobeo
ID: 24176622
Sorry! Been away on holiday.

Tinawin, your answer nailed it for me! Cheers!
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Nice table. Huge mess. Maybe this was something you created way back before you figured out tabs or a document you received from someone else. Either way, using the spacebar to separate the columns resulted in a mess. Trying to convert text to t…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
This video walks the viewer through the process of creating an MLA formatted document, as well as a bibliography with citations.
Learn how to create and modify your own paragraph styles in Microsoft Word. This can be helpful when wanting to make consistently referenced styles throughout a document or template.

695 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question