#1
|
|||
|
|||
combine 2 different word documents
Dear All,
Thank you for taking the time to read my post, I have a quick question and was wondering if anyone on this forum can help me, I have 2 separate word documents, I've labelled one odd as it contains the text page 1, 3 and 5, and the other document as even as it contains page 2, 4 and 6. My question is there a way to get word to combine these in order so it follows as this is page 1,2,3,4,5 and 6. I've called the final document proper way as this is how I want it joined together. Maybe a vba option might be needed, but thought I'd try this first? BTW both "odd" and "even" documents will have the same number of pages Thanks once again for taking the time to read my thread. Salim |
#2
|
||||
|
||||
Unless your pages are separated by manual page breaks or 'next page' Section breaks, there is no reliable way of doing this with VBA. That's because where a page starts & ends depends on the layout optimisations Word does for the active printer driver.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
Thank you sir for your feedback,
If you manage to find a solution to this problem i would be very grateful. I guess inserting manual page breaks or next page section breaks may be the only way. Thank you for your time. |
#4
|
|||
|
|||
There is no solution because of both the nature of Word and the unusual nature of your need.
I am curious. Why do you want to do this. It seems unnecessarily complex. |
#5
|
|||
|
|||
Hi Charles,
My intention in the long term is to merge some excel charts into a word document, and have these back to back on an A4 sheet of paper. I'm still looking into this matter and came up with this idea as i painstakingly found a way of creating my Excel charts in word by paste linking each sheet and making this into a word document. I therefore just need a way now to combine my report to the excel sheets. Weird i know, but its something i thought of as a spur of the moment thing, any help would be greatly appreciated. |
#6
|
||||
|
||||
if you add the following macro to the documents whose content you want to insert the charts after, then run the macro and select the charts document, it should insert the charts into the document you're running the macro from. As I indicated, though, you're liable to get different results if you run the macro on a different computer.
Code:
Sub Demo() Application.ScreenUpdating = False Dim DocSrc As Document, DocTgt As Document Dim i As Long, RngSrc As Range, RngTgt As Range Set DocTgt = ActiveDocument With Application.FileDialog(FileDialogType:=msoFileDialogFilePicker) .Title = "Select the source file" .AllowMultiSelect = False If .Show = -1 Then Set DocSrc = Documents.Open(.SelectedItems(1), ReadOnly:=True, AddToRecentFiles:=False) Else MsgBox "No source file selected. Exiting", vbExclamation Exit Sub End If End With With DocSrc For i = .ComputeStatistics(wdStatisticPages) To 1 Step -1 Set RngSrc = .Range.GoTo(What:=wdGoToPage, Name:=i) Set RngSrc = RngSrc.GoTo(What:=wdGoToBookmark, Name:="\page") Set RngTgt = DocTgt.Range.GoTo(What:=wdGoToPage, Name:=i) Set RngTgt = RngTgt.GoTo(What:=wdGoToBookmark, Name:="\page") RngTgt.Characters.Last.FormattedText = RngSrc.FormattedText Next .Close SaveChanges:=False End With ErrExit: Set RngSrc = Nothing: Set RngTgt = Nothing Set DocSrc = Nothing: Set DocTgt = Nothing Application.ScreenUpdating = True End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#7
|
|||
|
|||
Thank you sir.
|
Thread Tools | |
Display Modes | |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Combine documents makes duplicate word | vincelge | Word | 2 | 05-15-2017 05:47 AM |
After Mail merging single documents - how to combine several documents into one? | Abacus1234 | Mail Merge | 16 | 06-25-2015 06:56 AM |
combine multiple documents word starter 2010 | bribelge | Word | 3 | 12-19-2012 09:25 AM |
OK I know its a dumb question but how can I combine word documents? | hellno187 | Word | 2 | 12-16-2012 12:32 PM |
How can a combine three seperate word documents into one? | hellno187 | Word | 0 | 09-20-2010 02:46 PM |