Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 09-09-2010, 09:00 AM
revans611 revans611 is offline 100 Primary Mail Merge Documents - want to add a table with fields to all of the primary documents Windows Vista 100 Primary Mail Merge Documents - want to add a table with fields to all of the primary documents Office 2007
Novice
100 Primary Mail Merge Documents - want to add a table with fields to all of the primary documents
 
Join Date: May 2009
Location: Houston, TX
Posts: 9
revans611 is on a distinguished road
Default 100 Primary Mail Merge Documents - want to add a table with fields to all of the primary documents

I have about 100 documents that I am going to make into mailmerge documents. Each document has an identical table where I am going to insert merge fields. I would like to create one document that contains only the table complete with mailmerge fields and then have that document be automatically inserted into each of the 100 documents when they are loaded for mailmerge. This would mean that I have to create the mailmerge fields for the table only once instead of 100 times. Can do?
Reply With Quote
  #2  
Old 09-14-2020, 11:21 PM
shansid shansid is offline 100 Primary Mail Merge Documents - want to add a table with fields to all of the primary documents Windows 10 100 Primary Mail Merge Documents - want to add a table with fields to all of the primary documents Office 2013
Novice
 
Join Date: Sep 2020
Posts: 4
shansid is on a distinguished road
Default

Maybe this link can resolve your issue:- https://www.msofficeforums.com/word-...documents.html
Reply With Quote
  #3  
Old 09-15-2020, 01:54 AM
gmayor's Avatar
gmayor gmayor is offline 100 Primary Mail Merge Documents - want to add a table with fields to all of the primary documents Windows 10 100 Primary Mail Merge Documents - want to add a table with fields to all of the primary documents Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,101
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

There would be nothing 'automatic' about it, but you could certainly create a document containing a table with merge fields and then using that document to replace a similar table in a batch of documents. The main issue is that of identifying the table to be replaced, especially if there is more than one table in the document.

Assuming that the tables have no merged or split cells, the following custom process used in conjunction with Document Batch Processes will replace the first matching table in the batch of documents with the table in your sample document with the fields.
Code:
Sub ChangeTable(oTarget As Document)
Dim oSource As Document
Dim oTable1 As Table, oTable2 As Table
Dim oRng As Range, oRng1 As Range
    'Change path to reflect the location of the source document
    Set oSource = Documents.Open(Environ("USERPROFILE") & "\Desktop\TableSource.docx")
    oSource.MailMerge.MainDocumentType = wdNotAMergeDocument
    Set oTable1 = oSource.Tables(1)
    Set oRng1 = oTable1.Range
    oRng1.End = oRng1.End + 1
    For Each oTable2 In oTarget.Tables
        If oTable2.Rows.Count = oTable1.Rows.Count And _
           oTable2.Columns.Count = oTable1.Columns.Count Then
            Set oRng = oTable2.Range
            oRng.End = oRng.End + 1
            oRng.Text = ""
            oRng.FormattedText = oRng1.FormattedText
            Exit For
        End If
        DoEvents
    Next oTable2
lbl_Exit:
    Set oSource = Nothing
    Set oTarget = Nothing
    Set oTable1 = Nothing
    Set oTable2 = Nothing
    Set oRng = Nothing
    Set oRng1 = Nothing
    Exit Sub
End Sub
Do you actually need 100 mail merge documents? In what way do those documents differ from one another?
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
  #4  
Old 09-15-2020, 12:07 PM
Charles Kenyon Charles Kenyon is offline 100 Primary Mail Merge Documents - want to add a table with fields to all of the primary documents Windows 10 100 Primary Mail Merge Documents - want to add a table with fields to all of the primary documents Office 2019
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 9,081
Charles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant future
Default

You could also save your table as AutoText or a QuickTable and then manually insert into the appropriate templates.
I join Graham's question as to the need for all those primary merge documents.
Reply With Quote
Reply

Tags
mailmerge

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
100 Primary Mail Merge Documents - want to add a table with fields to all of the primary documents Primary Command Buttons (along top of window) Disappeared Andrew H Word 8 01-04-2018 06:48 AM
Primary color theme in PowerPoint broiling PowerPoint 0 10-03-2017 01:02 AM
Mail Merge - Word primary, Excel secondary - track changes marking voyagerone Mail Merge 9 06-30-2017 08:55 PM
After Mail merging single documents - how to combine several documents into one? Abacus1234 Mail Merge 16 06-25-2015 06:56 AM
Two Primary calendars?!?!? Outlook 2013 countersteer Outlook 0 03-30-2014 06:38 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 09:45 AM.


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