UpdateDocument Method

Microsoft Word Visual Basic

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

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

expression.UpdateDocument

expression    Required. An expression that returns an Envelope object.

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