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. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
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
|
|||
|
|||
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 | |
|
|