• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 285
  • Last Modified:

Mailmerge condition to next label

I have a mailmerge between word 2010 and an excel spreadsheet. Each record in the spreadsheet includes a quantity field in which I wish to print that particular label the specified number of times before going to the next label.

What do I have to do to print a label based on the quantity of labels before going to the next label? A specific example is appreciated.
0
swanzey
Asked:
swanzey
  • 4
1 Solution
 
GrahamSkanCommented:
I think that the easiest way would be to create a new sheet that has a row for each instance of each required label.
0
 
swanzeyAuthor Commented:
But isn't there a way to use nextif while decrementing the qty counter or something?

Thx
0
 
GrahamSkanCommented:
I have considered running the MailMerge under VBA control, but I can see snags in the case of labels. It might be possible using arithmetic in Word Fields.

I'll look again at each approach, but, as I said, creating a new sheet especially for the merge would seem to be the simplest way.
0
 
GrahamSkanCommented:
I've tried VBA. I works in producing the correct number of labels, but each one is the first on a new page of labels.
Sub MultiLabels(wdDoc As Word.Document)
    Dim r As Integer
    Dim LabelCount As Integer
    With wdDoc.MailMerge
        .MainDocumentType = wdMailingLabels
        .Destination = wdSendToNewDocument
        For r = 1 To .DataSource.RecordCount
            .DataSource.LastRecord = r
            .DataSource.FirstRecord = r
            LabelCount = .DataSource.DataFields("Count").Value
            Do While LabelCount > 0
                .Execute
                LabelCount = LabelCount - 1
            Loop
            .Execute
        Next r
    End With
End Sub

Open in new window

0
 
GrahamSkanCommented:
We can store the count value in a bookmark

SET bmkLabelCount { MERGEFIELD COUNT }

and test it

{NEXTIF  bmkLabelCount  = 0 }

but I can't see a way of decrementing it for each label that is printed
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now