Excel to Word Mail Merge

J

Jo8379

I'm using an excel data list and want to merge it to Word labels. It looks
good at first glance, but then I noticed that one label is missing at the end
of each page. They are included on the data list - just skipped in the merge.
I think there is a code or a switch I'm missing on my form document at the
end of the page...Help
 
J

Jo8379

I figured it out - but one more question...My list is in alpha order and I
want the lables to print down the first column then down the second column
rather that across the row. Is there a way to make that happen?
 
J

jomuir

In Excel, highlight your data, copy it……then open a new wookbook and ‘paste
special’ tick the option to ‘Transpose’ that okay it.

Save this new workbook as what ever you want (you can delete it after the
mail merge) and then use this data for you mail merge.
 
J

Jo8379

When I do this, it does not recognize my merge fields any longer. Can't find
"First" for example. Wants me to replace them but they are not listed.
 
G

Graham Mayor

You might find it easier to copy the table to Word then run the following
macro from fellow MVP Doug Robbins to sort it into the required order to
match your label sheet. Then use that as a data source for your merge.

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 = "3" ' 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 = "8" ' 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

http://www.gmayor.com/installing_macro.htm

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


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
J

jomuir

You just copy and paste the data, not the field hearders........

Then in your word document on your mail merger tool bar the second item is
open data source - pick this new workbook that you have created.

You template has not changed, and should be looking for the same fields, so
here all you have done is point to the same data in the same format, just in
a different order.

(If I have understood what you are looking for)
 

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