Muokkaa

Jaa


Envelope.UpdateDocument method (Word)

Updates the envelope in the document with the current envelope settings.

Syntax

expression. UpdateDocument

expression Required. A variable that represents an 'Envelope' object.

Remarks

If you use this property before an envelope has been added to the document, an error occurs.

Example

This example formats the envelope in Report.doc to use a custom envelope size (4.5 inches by 7.5 inches).

Sub UpdateEnvelope() 
 
 On Error GoTo errhandler 
 
 With Documents("Report.doc").Envelope 
 .DefaultHeight = InchesToPoints(4.5) 
 .DefaultWidth = InchesToPoints(7.5) 
 .UpdateDocument 
 End With 
 
 Exit Sub 
 
errhandler: 
 
 If Err = 5852 Then _ 
 MsgBox "Report.doc doesn't include an envelope" 
 
End Sub

This example adds an envelope to the active document, using predefined addresses. The default envelope bar code and Facing Identification Mark (FIM-A) settings are set to True, and the envelope in the active document is updated.

Dim strAddress As String 
Dim strReturn As String 
 
strAddress = "Darlene Rudd" & vbCr & "1234 E. Main St." _ 
 & vbCr & "Our Town, WA 98004" 
strReturn = "Patricia Reed" & vbCr & "N. 33rd St." _ 
 & vbCr & "Other Town, WA 98040" 
ActiveDocument.Envelope.Insert _ 
 Address:=strAddress, ReturnAddress:=strReturn 
With ActiveDocument.Envelope 
 .DefaultPrintBarCode = True 
 .DefaultPrintFIMA = True 
 .UpdateDocument 
End With

See also

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