Re: Mail Merge Combine Records To Table

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Hi Kevin,

If you use the field coding from my tutorial, you could insert a single-row table containing the mergefields in it, in place of the '{ MERGEFIELD City } { MERGEFIELD Representative } { MERGEFIELD Sales }' sequence. Then, when you've completed the merge, run a macro like the following over the output document:

Sub MailMergeTableJoiner()
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 Len(.Text) = 1 Then .Delete
End If
End With
End If
End With
Next
End Sub

--
Cheers
macropod
[MVP - Microsoft Word]


"KevinL" <KevinL@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message news:0D61E395-5ED6-41FF-A5B1-CC8D1031A962@xxxxxxxxxxxxxxxx
For simplicity's sake, let's say I have 3 fields in my spreadsheet: City,
Employee, and Sales (just like the Microsoft example).

I want my City to be printed once in the document, and then I want a
2-column table with Employee and Sales. There would be a column heading plus
a row in the column for each row in the spreadsheet (for the matching city).

"Doug Robbins - Word MVP on news.microsof" wrote:

Without seeing the actual arrangement of fields that you have come up with,
it is hard to advise you how to go about this. It may be however that you
will need to convert the relevant text to a table after executing the merge.
While that can probably be done with the use of a macro, more would need to
be known about what the merge produces to provide the code that would be
required.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com

"KevinL" <KevinL@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:533D4C0F-C95F-4A20-BE73-B86121EE4991@xxxxxxxxxxxxxxxx
>I have a need to create a Word Document from Excel. My Excel spreadheet
>has
> multiple rows. Each row has the person's name (just 1 name in the entire
> spreadsheet) and the material they may be exposed to, and the exposure
> level
> (multiple materials, 1 on each row).
>
> I would like to put the material and exposure level in a Table in Word. I
> have progressed to where I am able to show the name just once and each
> material on a separate line on the same page, but it would look cleaner if
> I
> could put these elements in a Table.
>
> I have reviewed each of these links below, all are helpful but none show
> how
> to put the rows into a Table.
>
> Thanks to anyone who is able to advise me whether this is possible or not.
>
> Microsoft
> http://support.microsoft.com/default.aspx/kb/294686/en-us
>
> MVP macropod's tutorial
> http://www.wopr.com/cgi-bin/w3t/showthreaded.pl?Number=731107
>
> Cornell Training Article
> http://cornell.veplan.net/article.aspx?&a=3815




.



Relevant Pages

  • Re: Excel random number
    ... when I generate a large number of random numbersand run the spreadsheet through Macro for a large number of times, sometimes, negative random number appears. ... I'm sort of wondering what is going on with the random generator of Excel 2003, and if Microsoft if going to develop a update to solve this problem. ...
    (microsoft.public.excel.misc)
  • 2003 Macro in Excel 2007
    ... I have a spreadsheet with a macro that I set up in Excel 2003. ... macro added information and then sent to another user who has Microsoft 2003. ... ' Macro to allow spell checking of password protected Excel Forms ...
    (microsoft.public.excel.misc)
  • Re: How do you categorize sum of fields
    ... If you are currently handling this via a spreadsheet, ... "Jeff Boyce" wrote: ... Created a table (tbl PO) with the following fields: ... the fields Avg Of Paper% + avg Of Other Materials + avg Of Other ...
    (microsoft.public.access.gettingstarted)
  • RE: MACRO
    ... After running this macro I am getting output like: ... "Jacob Skaria" wrote: ... vendors ..and number of vendors and materials are not fixed it is depend on ... Material vendor price rating ...
    (microsoft.public.excel.misc)
  • RE: How to concatenate several entries to same table
    ... Any new suggestions other then learn VBA? ... >Microsoft Security Bulletin MS03-026? ... >| materials for the part into one field: ...
    (microsoft.public.access.queries)