Microsoft Office Forums Merging multiple items to a table, Formatting

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 07-19-2018, 07:04 AM
orion23 orion23 is offline Merging multiple items to a table, Formatting Windows 10 Merging multiple items to a table, Formatting Office 2016
Novice
Merging multiple items to a table, Formatting
 
Join Date: Jul 2018
Posts: 5
orion23 is on a distinguished road
Default Merging multiple items to a table, Formatting

Hello Everyone!



Looking for some help with the formatting structure of letter using mail merge of multiple rows to a table

I am using the following table created by Paul Edstein, for another user over at windowsecrets:
https://forums.windowssecrets.com/sh...ussions/page11

This table fits my needs. However, I am having problems with the formatting of the letter and the table itself

I am inserting the body of the letter between "SET Key { MERGEFIELD Source_Supplier }} AND the beginning of the actual table (Results are OK, except that the 1st record or merge has an extra line space at the top, this is not a problem, I'm simply "reporting")(I did insert a single merge field at the very top)

The formatting problems I have:

1: How can I force the table to have no spaces between the table headers and the rows below ?

2: Also, no spaces between rows (I will have up to 8 rows merged and need the space in the letter)

3: How to force a break to start a new record after the table is completed ? (The data is sorted by Source_Supplier) When the Source supplier changes, a new document should start (I believed I solved this one by using the "QUOTE 12" code and combining it with what you had done)

4: Is it possible to merge a 2 page document (2 languages) side by side (I tried and only the 1st record worked, then only the 1st page would be merged, skipping the 2nd page) (This is not a big deal but it would be nice... I can run the merge 2 times, individually and use the resulting 2 files with merged records)

Thank you all for your time and your valued contributions
Attached Files
File Type: doc Merge Data Table Maker (1).doc (49.0 KB, 6 views)

Last edited by orion23; 07-19-2018 at 11:57 AM.
Reply With Quote
  #2  
Old 07-19-2018, 06:01 PM
macropod's Avatar
macropod macropod is online now Merging multiple items to a table, Formatting Windows 7 64bit Merging multiple items to a table, Formatting Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 19,480
macropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to behold
Default

As indicated in the link from which you got the field coding, the document was part of a larger project that executes a macro upon completion of the merge. Amongst other things, that macro removes the empty paragraphs between the tables.
__________________
Cheers,
Paul Edstein
[MS MVP - Word]
Reply With Quote
  #3  
Old 07-19-2018, 07:40 PM
orion23 orion23 is offline Merging multiple items to a table, Formatting Windows 10 Merging multiple items to a table, Formatting Office 2016
Novice
Merging multiple items to a table, Formatting
 
Join Date: Jul 2018
Posts: 5
orion23 is on a distinguished road
Default

TBH, I liked the simple table layout and I modified it to be used in my current task

I took the table idea and merged it with this:

{QUOTE{IF{MERGESEQ} = 1 {SET Key ""}{SET LastKey {Key}}}{If{MERGEFIELD id} <> {Key} "{IF{MERGESEQ} > 1"


{IF{MERGEFIELD id} <> 0 {QUOTE 12}}""}{IF{MERGEFIELD id} <> 0 "(this is the body of my letter {SET KEY {MERGEFIELD id}}


id: {MERGEFIELD id\* Charformat}

(this is where I inserted your table)

"}"}"{IF{MERGEFIELD id} <> 0 "{MERGEFIELD date} / {MERGEFIELD time} {MERGEFIELD location}
"}"}

What I have is a letter with a 3 column table where 3 fields are merged in a list form

Everything looks great and works fine at this time, however, I'm afraid that I won't have much room left in the body of the letter since every entry in the list leaves me with an empty space in between each row. The records I will merge can be up to a total of 8, and with the extra blank row, I'm looking at too much wasted space

Do you know how I can solve that part ? (I'll try uploading that latest version of the file tomorrow...)

and if possible, could you confirm if a directory type of merge can be used in a 2 page document (same mergefields, table, just 2 different languages, side by side)

Also, the result needs to be a single word document with all individual records, separated by page, which is what I have.

The only concern at this time really is the extra rows (and possibly the 2 page merge but that can be resolved with an additional, separate merge)

Thanks again for your time!
Reply With Quote
  #4  
Old 07-19-2018, 07:47 PM
macropod's Avatar
macropod macropod is online now Merging multiple items to a table, Formatting Windows 7 64bit Merging multiple items to a table, Formatting Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 19,480
macropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to behold
Default

Please read 'Merging to Tables' in the tutorial, which you can download from any of:
http://www.msofficeforums.com/word/3...-tutorial.html
https://forums.windowssecrets.com/sh...merge-Tutorial
http://www.gmayor.com/downloads.htm#Third_party
__________________
Cheers,
Paul Edstein
[MS MVP - Word]
Reply With Quote
  #5  
Old 07-19-2018, 08:06 PM
orion23 orion23 is offline Merging multiple items to a table, Formatting Windows 10 Merging multiple items to a table, Formatting Office 2016
Novice
Merging multiple items to a table, Formatting
 
Join Date: Jul 2018
Posts: 5
orion23 is on a distinguished road
Default

So I need to run this Macro ?

Code:
Sub TableJoiner()
Application.ScreenUpdating = False
Dim oPara As Paragraph
For Each oPara In ActiveDocument.Paragraphs
  With oPara.Range
    If .Information(wdWithInTable) = True Then
      With .Next
        If .Information(wdWithInTable) = False Then
          If .Text = vbCr Then .Delete
        End If
      End With
    End If
  End With
Next
Application.ScreenUpdating = True
End Sub
I'll give this a shot tomorrow (big time difference with us...)
My fear is that by removing the rows after the merge, all records will shift up and won't remain as individual records

If you think of something else that I might be missing, kindly point it out

Thanks for your help!

Last edited by macropod; 07-19-2018 at 09:52 PM. Reason: Added code tags
Reply With Quote
  #6  
Old 07-19-2018, 09:58 PM
macropod's Avatar
macropod macropod is online now Merging multiple items to a table, Formatting Windows 7 64bit Merging multiple items to a table, Formatting Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 19,480
macropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to behold
Default

Yes. FWIW, if you:
1. save it in your mailmerge main document (which means using the .doc or .docm format)
2. rename the macro to MailMergeToDoc
3. insert the line:
ThisDocument.MailMerge.Execute Pause:=False
after:
Dim oPara As Paragraph
the macro will run automatically when you click on the 'Edit Individual Documents' button.

PS: When posting code, please use the code tags, indicated by the # button on the posting menu. Without them, your code loses much of whatever structure it had.
__________________
Cheers,
Paul Edstein
[MS MVP - Word]
Reply With Quote
  #7  
Old 07-20-2018, 04:54 AM
orion23 orion23 is offline Merging multiple items to a table, Formatting Windows 10 Merging multiple items to a table, Formatting Office 2016
Novice
Merging multiple items to a table, Formatting
 
Join Date: Jul 2018
Posts: 5
orion23 is on a distinguished road
Default

Good morning*

Just tried the original macro and it pauses to process for about 3 seconds but nothing happens (No errors)

I also tried as you suggested (rename + ThisDocument.MailMerge.Execute Pause:=False) but a receive the following error when I click on "Finish & Merge" "Edit individual documents"

This method or property is not available because the document is not a mail merge main document

Any ideas ?

Honestly, I don't have to use a table, but it helps me with the alignment of the merged data, which I cannot align otherwise (I've tried...)

If you could, can I ask you to please help me alight the column headers (Date, Time and Location) with the corresponding mergefields just below ?
Date and time vary in lenght

Thanks for your help!
Reply With Quote
  #8  
Old 07-21-2018, 03:33 PM
orion23 orion23 is offline Merging multiple items to a table, Formatting Windows 10 Merging multiple items to a table, Formatting Office 2016
Novice
Merging multiple items to a table, Formatting
 
Join Date: Jul 2018
Posts: 5
orion23 is on a distinguished road
Default

I believe I finally understand the alignment part
(will confirm once back in the office)
Reply With Quote
  #9  
Old 07-21-2018, 11:41 PM
macropod's Avatar
macropod macropod is online now Merging multiple items to a table, Formatting Windows 7 64bit Merging multiple items to a table, Formatting Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 19,480
macropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to behold
Default

Quote:
Originally Posted by orion23 View Post
when I click on "Finish & Merge" "Edit individual documents"
That suggests you added it to something other than your mailmerge main document...
__________________
Cheers,
Paul Edstein
[MS MVP - Word]
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Merging multiple items to a table, Formatting Pivot Table: Show Data For Multiple Items jhato160 Excel 14 08-01-2016 11:24 AM
Merging multiple items to a table, Formatting VBA Pivot Table CubeField Enable multiple items Wries Excel Programming 0 03-13-2014 09:56 AM
After merging a reviewer's changes, formatting is lost cassidyjames Word 0 03-27-2012 01:48 PM
Merging multiple items to a table, Formatting Copy table cell formatting across multiple cells / tables pakistanray Word Tables 2 10-31-2011 08:07 AM
Merging multiple items to a table, Formatting Merging multiple .txt's Bartestokles Word 5 12-29-2010 01:42 PM


All times are GMT -7. The time now is 04:00 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
Search Engine Optimisation provided by DragonByte SEO v2.0.37 (Lite) - vBulletin Mods & Addons Copyright © 2019 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft