Share via


CustomLabels.Add Method

Word Developer Reference

Adds a custom mailing label to the CustomLabels collection. Returns a CustomLabel object that represents the custom mailing label.

Syntax

expression.Add(Name, DotMatrix)

expression   Required. A variable that represents a CustomLabels collection.

Parameters

Name Required/Optional Data Type Description
Name Required String The name for the custom mailing labels.
DotMatrix Optional Variant True to have the mailing labels printed on a dot-matrix printer.

Return Value
CustomLabel

Example

This example adds a custom mailing label named Return Address, sets the page size, and then creates a page of these labels.

Visual Basic for Applications
  Sub ReturnAddrLabel()
    Dim ml As CustomLabel
    Dim addr As String
Set ml = Application.MailingLabel.CustomLabels _
    .<strong class="bterm">Add</strong>(Name:="Return Address", DotMatrix:=False)
ml.PageSize = wdCustomLabelLetter
addr = "Dave Edson" &amp; vbCr &amp; "123 Skye St." &amp; vbCr _
    &amp; "Our Town, WA  98004"
Application.MailingLabel.CreateNewDocument _
    Name:="Return Address", Address:=addr, ExtractAddress:=False

End Sub

See Also