A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Word » Mailmerge
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Layout of Data in tables



 
 
Thread Tools Display Modes
  #1  
Old June 28th, 2009, 10:31 PM posted to microsoft.public.word.mailmerge.fields
Yookaroo
external usenet poster
 
Posts: 17
Default Layout of Data in tables

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
  #2  
Old June 29th, 2009, 05:58 AM posted to microsoft.public.word.mailmerge.fields
Graham Mayor
external usenet poster
 
Posts: 18,297
Default Layout of Data in tables

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_lab...th_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

My web site www.gmayor.com
Word MVP web site http://word.mvps.org



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


Yookaroo wrote:
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



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 10:12 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.