DefaultSize Property

Microsoft Word Visual Basic

Returns or sets the default envelope size. Read/write String.

Note  The string that's returned corresponds to the right-hand side of the string that appears in the Envelope Size box in the Envelope Options dialog box. If you set either the DefaultHeight or DefaultWidth property, the envelope size is automatically changed to Custom Size in the Envelope Options dialog box (Tools menu) and this property returns "Custom size."

Example

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

ActiveDocument.Envelope.DefaultSize = "C4"
		

This example asks the user whether or not they want to change the default envelope size to Size 10. If the answer is yes, the default size is changed accordingly. The UpdateDocument method changes the envelope size for the active document. If an envelope has not been added to the active document, a message box is displayed.

Sub exDefaultSize()

    Dim intResponse As Integer

    On Error GoTo errhandler
    intResponse = MsgBox("Do you want to set the " _
        & "default envelope to Size 10?", 4)
    If intResponse = vbYes Then
        With ActiveDocument.Envelope
            .DefaultSize = "Size 10"
            .UpdateDocument
        End With
    End If

    Exit Sub

errhandler:
    If Err = 5852 Then _
        MsgBox "An envelope isn't part of this document"
End Sub