Muokkaa

Jaa


Document.Envelope property (Word)

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).

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

See also

Document Object

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.