Layout of Data in tables

Y

Yookaroo

I have a table with 3 columns I have product fields 1 to 21 in the first
column, the second is a spacer and I have products 22 to 41 in the third.

I want the third column to always start with 22 or above, but when certain
records have less than 21 in the first column 22 and above will show up in
the 1st column again?

I even tried this with columns (with column break) yet the fields 1 to 41
seem to always stay together.

Also if I want a hard return after a field how do I put that into the mail
merge statement?

Thanks in advance
 
G

Graham Mayor

If you are merging into a table, the merge will always track across the
table from left to right. What you see displayed in the merge source
document does not reflect the result of the final merge. It only affects the
current record. See http://www.gmayor.com/mail_merge_labels_with_word_xp.htm
or http://www.gmayor.com/merge_labels_with_word_2007.htm
If you want the merge to fill the first column of the table before starting
the second (or in your case third) you would have to reorganise your data
source to take account of the different order. If that data source is a word
table then the following macro will order it. The defaults assume a merge
document table with 2 columns and 21 rows.

"Also if I want a hard return after a field how do I put that into the mail
merge statement"
You'll have to be a bit more explicit about what you mean by this that is
not covered by pressing the enter key after inserting the field.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>


Sub SortData()
' Macro to assign numbers to data source so that it can be sorted to cause
'labels to print down columns
Dim Message, Title, Default, labelrows, labelcolumns, _
i As Integer, j As Integer, k As Integer
Message = "Enter the number of labels in a row" ' Set prompt.
Title = "Labels per Row" ' Set title.
Default = "2" ' Set default.
' Display message, title, and default value.
labelcolumns = InputBox(Message, Title, Default)
Message = "Enter the number of labels in a column" ' Set prompt.
Title = "Labels per column" ' Set title.
Default = "21" ' Set default.
labelrows = InputBox(Message, Title, Default)
With ActiveDocument.Tables(1)
..Columns.Add BeforeColumn:=ActiveDocument.Tables(1).Columns(1)
..Rows(1).Range.Cut
End With
k = 1
For i = 1 To ActiveDocument.Tables(1).Rows.Count - labelcolumns
For j = 1 To labelrows
ActiveDocument.Tables(1).Cell(i, 1).Range.InsertBefore _
k + (j - 1) * labelcolumns
i = i + 1
Next j
k = k + 1
i = i - 1
If k Mod labelcolumns = 1 Then k = k - labelcolumns + _
labelcolumns * labelrows
Next i
ActiveDocument.Tables(1).Sort FieldNumber:="Column 1"
ActiveDocument.Tables(1).Rows(1).Select
Selection.Paste
ActiveDocument.Tables(1).Columns(1).Delete
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top