Changing direction for label merge output (vertical vs. horizontal

F

ferronjm

Is there a way to specify the direction a label merge comes out? I am using
a label template to create an address directory and would like the labels to
go vertically and they keep coming out horizonally.
 
D

Doug Robbins

If your datasource is an Access database, or you can import the data into
Access, it's Label Report Wizard gives you the option of printing the labels
either way.

If you don't have Access and the datasource is a Word document, if you run
the following macro over that document, it will sort the labels so that,
based on the original order, they print down the columns.

' Macro to assign numbers to data source so that it can be sorted to cause
' labels to print down columns
' Created by Doug Robbins - Word MVP

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 = "5" ' Set default.
labelrows = InputBox(Message, Title, Default)
ActiveDocument.Tables(1).Columns.Add
BeforeColumn:=ActiveDocument.Tables(1).Columns(1)
ActiveDocument.Tables(1).Rows(1).Range.Cut
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

--
Please respond to the Newsgroup for the benefit of others who may be
interested. Questions sent directly to me will only be answered on a paid
consulting basis.

Hope this helps,
Doug Robbins - Word MVP
 
D

Doug Robbins

That looks OK. Exactly what happens when you run it? Does it give an error
message? If so, what line is highlighted it you select debug?

--
Please respond to the Newsgroup for the benefit of others who may be
interested. Questions sent directly to me will only be answered on a paid
consulting basis.

Hope this helps,
Doug Robbins - Word MVP
 
M

Mike G

So you understand what I am doing I am creating labels in Word from by
merging data from Excel. I am specifying an Avery 8160 format and
performing the task with the mail merge wizard. After I have created my
labels I merged them into a new document and I run the macro on that
document. I am requested to enter row and column numbers and then all that
happens is it moved row 3 and 4 down to 9 and 10 all of the other data
remained the same. I had several pages of labels and it only did this on the
first page the other pages remained the same.

Thank you for the help MikeG
 
D

Doug Robbins

OK, It was not set up to work that way. The data source has to be a table
in a Word document (read my original post). You can copy and paste the
excel data into Word, then run the macro on that document and then use that
document as the data source for creating the labels.

--
Please respond to the Newsgroup for the benefit of others who may be
interested. Questions sent directly to me will only be answered on a paid
consulting basis.

Hope this helps,
Doug Robbins - Word MVP
 

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