MailingLabel.CreateNewDocument Method (Word)
Creates a new label document using either the default label options or ones that you specify. Returns a Document object that represents the new document.
Syntax
expression .CreateNewDocument(Name, Address, AutoText, ExtractAddress, LaserTray, PrintEPostageLabel, Vertical)
expression Required. A variable that represents a MailingLabel object.
Parameters
Name |
Required/Optional |
Data Type |
Description |
---|---|---|---|
Name |
Optional |
Variant |
The mailing label name. |
Address |
Optional |
Variant |
The text for the mailing label. |
AutoText |
Optional |
Variant |
The name of the AutoText entry that includes the mailing label text. |
ExtractAddress |
Optional |
Variant |
True to use the address text marked by the user-defined bookmark named "EnvelopeAddress" instead of using the Address argument. |
LaserTray |
Optional |
Variant |
The laser printer tray. Can be one of the WdPaperTray constants. |
PrintEPostageLabel |
Optional |
Variant |
True to print postage using an Internet e-postage vendor. |
Vertical |
Optional |
Variant |
True formats text vertically on the label. Used for Asian-language mailing labels. |
Return Value
Document
Example
This example creates a new Avery 2160 minilabel document using a predefined address.
addr = "Dave Edson" & vbCr & "123 Skye St." _
& vbCr & "Our Town, WA 98004"
Application.MailingLabel.CreateNewDocument _
Name:="2160 mini", Address:=addr, ExtractAddress:=False
This example creates a new Avery 5664 shipping-label document using the selected text as the address.
addr = Selection.Text
Application.MailingLabel.CreateNewDocument _
Name:="5664", Address:=addr, _
LaserTray:=wdPrinterUpperBin
This example creates a new self-adhesive-label document using the EnvelopeAddress bookmark text as the address.
If ActiveDocument.Bookmarks.Exists("EnvelopeAddress") = True Then
Application.MailingLabel.CreateNewDocument _
Name:="Self Adhesive Tab 1 1/2""", ExtractAddress:=True
End If