Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multiple mail merges into a single document

Status
Not open for further replies.

Kelanen

IS-IT--Management
Nov 28, 2000
68
GB
Okay, I have a large MS Word document which has some pages populated by data held in a database (Access) - I've done this using a mail merge, and all works absolutely fine.

The problem is that in a different part of the document I want to populate it by different data from a different query within the database (could even be a separate database if it solved matters). I need to do this several more times in fact.

My really clunky workaround is to have separate word documents each with copied headers and footers, with page numbering starting at x, y , z, etc and the same number of blank pages inserted in the main document. This is obviously a big fudge, and the moment the main document changes, you have to go and manually change all the other page numbers, and then when the dataset expands you have to go back and allow more blank pages in the main document etc.

So - what I basically want is rather than being able to nominate a single data source, I want to nominate source1, source2, source3, etc and then call them as appropriate with some sort of flag on the merge fields. If this is possible, then for the life of me I can't figure out how!

I'm using MS Word 2000, and MS Access 2000 (should be irrelevant). If Word 2003 can cope with this then I would upgrade, but I've not been able to find anything to indicate that it would handle this situation differently to my current version.

Any ideas?

Jonathan Challis
IT Manager
 
Hi

I created something similar recently, to use several mailmerges in one document. (All from same db, but principle would still work) If you have a master document, with each of the completed merges as subdocuments it works. Removing the subdocs and 'save as...' then creates the final doc. Re-running any of the merges, and re-opening the master doc will provide an updated version.

In my case the vba code in the db runs a loop creating each of the sub-docs. The user then goes to the master doc and presses a button to turn the master doc into a single doc and 'save as'

erm.. does that make sense?

Regards


Jonathan
 
Okay this sounds like it's going in the right direction!

What is a subdocument, and how do you create one? (it's a word function I presume?)

...my data is all in a single db, and it is easiest to keep it that way if possible.

Is your code only to generate data subsets, or part of the merge/subdocument process? I already have the data subsets from queries, without the need to resort to coding (hopefully the rest of the process won't need it!).

Could you clarify what you meant by Save As on the sub-documents - you lost me there!

Thanks!

Jonathan Challis
IT Manager
 
Hi

First create the master document - you need outline view.
Unusually office help is quite useful - input 'master document' to follow it through. When you got to outline view the toolbar that pops up ('outlining') has most of the functions you need, although confusingly the button labelled 'remove subdocument' actually makes the contents of the subdoc a permanent part of the main doc.

The macro I use to automate the process of turning the main document into a 'normal' one is as follows :-

Code:
 Sub Finalise_WhosWho()
'
' Finalise_WhosWho Macro
' Converts Subdocs into main doc
'
    ActiveWindow.ActivePane.View.Type = wdMasterView
    ActiveDocument.Subdocuments.Expanded = Not ActiveDocument.Subdocuments.Expanded
    ActiveDocument.Subdocuments.Delete
    
        If ActiveWindow.View.SplitSpecial = wdPaneNone Then
        ActiveWindow.ActivePane.View.Type = wdPrintView
    Else
        ActiveWindow.View.Type = wdPrintView
    End If
    ActiveDocument.SaveAs FileName:="Final Who's Who.doc", FileFormat:= _
        wdFormatDocument, LockComments:=False, Password:="", AddToRecentFiles:= _
        True, WritePassword:="", ReadOnlyRecommended:=False, EmbedTrueTypeFonts:= _
        False, SaveNativePictureFormat:=False, SaveFormsData:=False, _
        SaveAsAOCELetter:=False

End Sub

Hope this helps!

Jonathan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top