Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.mailmerge.fields
SeamusM SeamusM is offline
external usenet poster
 
Posts: 1
Default Word 2003 Directory Mail merge from Excel 2003

Hi

I have a list of questions in a spreadsheet that I am filtering to generate
checklists for different respondents. At the moment I am using a directory
mail merge to generate the different checklists, filtering inside the 'mail
merge recipients' dialog box.
In the word doc, I have a table set up to contain the question and a space
for response. So at the moment, I get a series of tables with a new question
in each. The questions though, can be broken into subject areas, so I'd like
to display the subject (outside the table I've set up) on the word doc. i.e.
have a heading and then the tables relating to to that heading and then
another heading.

Is there a way to do this, I've tried playing around with nested IF's but I
haven't been able to get the order right. If I use an IF, can the output be a
table which contains mergefields?

Thanks


  #2   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Doug Robbins - Word MVP Doug Robbins - Word MVP is offline
external usenet poster
 
Posts: 8,832
Default Word 2003 Directory Mail merge from Excel 2003

If you have the Subject in the first cell of the one row table in the
Directory type mail merge main document and then after executing the merge
to a new document you run the following macro, it will create separate
tables with the records for each Subject in them. If that is not exactly
what you want, with a bit of further development, you should be able to get
it to do what you want.

' Macro to create multiple items per condition in separate tables from a
directory type mailmerge

Dim source As Document, target As Document, scat As Range, tcat As Range
Dim data As Range, stab As Table, ttab As Table
Dim i As Long, j As Long, k As Long, n As Long
Set source = ActiveDocument
Set target = Documents.Add
Set stab = source.Tables(1)
k = stab.Columns.Count
Set ttab = target.Tables.Add(Range:=Selection.Range, numrows:=1,
numcolumns:=k - 1)
Set scat = stab.Cell(1, 1).Range
scat.End = scat.End - 1
ttab.Cell(1, 1).Range = scat
j = ttab.Rows.Count
For i = 1 To stab.Rows.Count
Set tcat = ttab.Cell(j, 1).Range
tcat.End = tcat.End - 1
Set scat = stab.Cell(i, 1).Range
scat.End = scat.End - 1
If scat tcat Then
ttab.Rows.Add
j = ttab.Rows.Count
ttab.Cell(j, 1).Range = scat
ttab.Cell(j, 1).Range.Paragraphs(1).PageBreakBefore = True
ttab.Rows.Add
ttab.Cell(j + 1, 1).Range.Paragraphs(1).PageBreakBefore = False
For n = 2 To k
Set data = stab.Cell(i, n).Range
data.End = data.End - 1
ttab.Cell(ttab.Rows.Count, n - 1).Range = data
Next n
Else
ttab.Rows.Add
For n = 2 To k
Set data = stab.Cell(i, n).Range
data.End = data.End - 1
ttab.Cell(ttab.Rows.Count, n - 1).Range = data
Next n
End If
Next i


--
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

"SeamusM" wrote in message
...
Hi

I have a list of questions in a spreadsheet that I am filtering to
generate
checklists for different respondents. At the moment I am using a directory
mail merge to generate the different checklists, filtering inside the
'mail
merge recipients' dialog box.
In the word doc, I have a table set up to contain the question and a space
for response. So at the moment, I get a series of tables with a new
question
in each. The questions though, can be broken into subject areas, so I'd
like
to display the subject (outside the table I've set up) on the word doc.
i.e.
have a heading and then the tables relating to to that heading and then
another heading.

Is there a way to do this, I've tried playing around with nested IF's but
I
haven't been able to get the order right. If I use an IF, can the output
be a
table which contains mergefields?

Thanks




Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Directory in Mail Merge Word 2003 Colette Mailmerge 3 March 22nd 08 09:53 PM
Word 2003 Mail Merge cannot open Excel 2003 document stacey Microsoft Word Help 6 October 3rd 07 07:53 PM
Word 2003 SP2: Missing records in mail-merge from Excel to directory Bill Davy[_2_] New Users 6 August 14th 07 08:02 AM
Grouping an Excel Field in a Word 2003 Directory Merge Lynn Q Mailmerge 1 February 12th 07 07:33 AM
Mail Merge Word 2003 Excel 2003 database Gwendolyn Mailmerge 1 February 8th 06 02:59 PM


All times are GMT +1. The time now is 11:06 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"