Printing File Folder labels when Sheet not full

S

StephenW

I have a macro that does a mail merge to create file folder labels. How can
I tell Word where to start printing the labels when the sheet is not a full
sheet of labels?

Thanks
 
D

Doug Robbins - Word MVP

If the data source is a table in a Word document, the following macro will
temporarily add the required number of blank records into the data source so
that the first label prints on the label that you specify.

'Macro to set the first label on a part sheet of labels for a label type
mailmerge.
Dim MMMDoc As Document
Dim dsource As Document
Dim dtable As Table
Dim i As Long, j As Long
Set MMMDoc = ActiveDocument
With MMMDoc.MailMerge
If .MainDocumentType = wdMailingLabels Then
If .State = wdMainAndDataSource Then
Set dsource = Documents.Open(.DataSource.Name)
Set dtable = dsource.Tables(1)
i = InputBox("Enter the number of labels that have already been
used on the sheet.", "Set Starting Label")
If IsNumeric(i) Then
With dtable
For j = 1 To i
.Rows.Add BeforeRow:=.Rows(2)
Next j
End With
End If
.Destination = wdSendToNewDocument
.Execute
End If
End If
End With
dsource.Close wdDoNotSaveChanges

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
S

StephenW

Doug,
Thanks for the response. But my data source is not in a table, but simply a
Ascii comma delimited list. Do I just need to add blank records at the top
of my list for the labels that have been used?
Steve
 
D

Doug Robbins - Word MVP

Yes, but the blank records will need to have the requisite number of commas
to prevent Word from erroring our with a too few fields error message.

Alternatively, use the existing datasource with a catalog, or in later
versions of Word it is called directory, type mail merge in the main
document of which you insert a one row table with the fields names in the
cells of that table. Then when you execute that merge to a new document, it
will contain a row of data for each record in the datasource. You can then
insert a row at the top of the table into which you insert the merge field
names and use that as the data source.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

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