EPostageInsertEx Event

Microsoft Word Visual Basic

Show All Show All

EPostageInsertEx Event

Occurs when a user inserts electronic postage into a document.

expression.EPostageInsertEx(Doc, cpDeliveryAddrStart, cpDeliveryAddrEnd, cpReturnAddrStart, cpReturnAddrEnd, xaWidth, yaHeight, bstrPrinterName, bstrPaperFeed, fPrint, fCancel)

expression    An object of type Application declared with events in a class module. For information about using events with the Application object, see Using Events with the Application Object.

Doc    Required Document. The document to which electronic postage is being added.

cpDeliveryAddrStart     Long. The starting position in the document for the delivery address. Positioning corresponds to the value of the Start property for a Range object.

cpDeliveryAddrEnd     Long. The ending position in the document for the delivery address. Positioning corresponds to the value of the End property for a Range object.

cpReturnAddrStart     Long. The starting position in the document for the return address. Positioning corresponds to the value of the Start property for a Range object.

cpReturnAddrEnd     Long. The ending position in the document for the return address. Positioning corresponds to the value of the End property for a Range object.

xaWidth     Long. The width of the envelope in 1/1440-inch units.

yaHeight     Long. The height of the envelope in 1/1440-inch units.

bstrPrinterName     String. The name of the printer as specified on the Printing Options tab of the Envelope Options dialog box.

bstrPaperFeed     String. The feed method as specified on the Printing Options tab of the Envelope Options dialog box.

fPrint     Boolean. True if the user has specified to print the envelope. False if the user has specified to insert the envelope into the document.

fCancel     Boolean. True cancels the action the user specified as indicated in the fPrint parameter.

Example

The following example displays a message to the user. If the user cancels the message, then the action specified by the user is canceled.

    Private Sub App_EPostageInsertEx(ByVal Doc As Document, ByVal cpDeliveryAddrStart As Long, _
        ByVal cpDeliveryAddrEnd As Long, ByVal cpReturnAddrStart As Long, _
        ByVal cpReturnAddrEnd As Long, ByVal xaWidth As Long, ByVal yaHeight As Long, _
        ByVal bstrPrinterName As String, ByVal bstrPaperFeed As String, _
        ByVal fPrint As Boolean, fCancel As Boolean)

    Dim intResponse As Integer
    
    If fPrint = True Then
        intResponse = MsgBox("Make sure the printer is ready to print an envelope." & vbCrLf & _
            "When the printer is ready, click OK.", vbOKCancel)
            
            If intResponse = vbCancel Then
                fCancel = True
            End If
    End If
End Sub