Envelope Property

Microsoft Word Visual Basic

Envelope Property

       

Returns an Envelope object that represents envelope functionality and the envelope in the specified document. Read-only.

Example

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

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.

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.

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