Compartilhar via


Document.Envelope Property

Word Developer Reference

Returns an Envelope object that represents an envelope and envelope features in a document. Read-only.

Syntax

expression.Envelope

expression   A variable that represents a Document object.

Example

This example sets the default envelope size to C4 (229 x 324 mm).

Visual Basic for Applications
  ActiveDocument.Envelope.DefaultSize = "C4"

This example displays the delivery address if an envelope has been added to the document; otherwise, a message box is displayed.

Visual Basic for Applications
  On Error GoTo errhandler
addr = ActiveDocument.Envelope.Address.Text
MsgBox Prompt:=addr, Title:="Delivery Address"
errhandler:
If Err = 5852 Then MsgBox "Add an envelope to the document"

This example creates a new document and adds an envelope with a predefined delivery address and return address.

Visual Basic for Applications
  addr = "Don Funk" & vbCr & "123 Skye St." _
    & vbCr & "Our Town, WA  98040"
retaddr = "Karin Gallagher" & vbCr & "123 Main" _
    & vbCr & "Other Town, WA  98004"
Documents.Add.Envelope.Insert Address:=addr, ReturnAddress:=retaddr
ActiveDocument.ActiveWindow.View.Type = wdPrintView

See Also