Insert Method

Applies To

AutoTextEntry object, Envelope object, ShapeNodes collection object.

Description

AutoTextEntry object: Inserts the AutoText entry in place of the specified range. If you don't want to replace the range, use the Collapse method before using this method. The inserted AutoText entry is returned as a Range object.

Envelope object: Inserts an envelope as a separate section at the beginning of the specified document. The arguments for this method correspond to the options on the Envelopes tab in the Envelopes and Labels dialog box (Tools menu).

Syntax 1

expression.Insert(Where, RichText)

Syntax 2

expression.Insert(ExtractAddress, Address, AutoText, OmitReturnAddress,
ú ReturnAddress, ReturnAutoText, PrintBarCode, PrintFIMA, Size, Height, Width,
ú FeedSource, AddressFromLeft, AddressFromTop, ReturnAddressFromLeft,
ú ReturnAddressFromTop, DefaultFaceUp, DefaultOrientation)

expression Required. An expression that returns an AutoTextEntry object (Syntax 1) or an Envelope object (Syntax 2).

Where Required Range object. The location for the AutoText entry.

RichText Optional Variant. True to insert the AutoText entry with its original formatting.

ExtractAddress Optional Variant. True to use the text marked by the EnvelopeAddress bookmark (a user-defined bookmark) as the recipient's address.

Address Optional Variant. A string that specifies the recipient's address (ignored if ExtractAddress is True).

AutoText Optional Variant. A string that specifies an AutoText entry to use for the address. If specified, Address is ignored.

OmitReturnAddress Optional Variant. True to omit the return address.

ReturnAddress Optional Variant. A string that specifies the return address.

ReturnAutoText Optional Variant. A string that specifies an AutoText entry to use for the return address. If specified, ReturnAddress is ignored.

PrintBarCode Optional Variant. True to add a POSTNET bar code. For U.S. mail only.

PrintFIMA Optional Variant. True to add a Facing Identification Mark (FIMA) for use in presorting courtesy reply mail. For U.S. mail only.

Size Optional Variant. A string that specifies the envelope size. The string should match one of the sizes listed on the left in the Envelope size box in the Envelope Options dialog box (for example, "Size 10" or "C4").

Height Optional Variant. The height of the envelope (in points) when the Size argument is set to "Custom size."

Width Optional Variant. The width of the envelope (in points) when the Size argument is set to "Custom size."

FeedSource Optional Variant. The paper tray to be used when the envelope is printed. Can be one of the following WdPaperTray constants:

  • wdPrinterAutomaticSheetFeed
  • wdPrinterDefaultBin
  • wdPrinterEnvelopeFeed
  • wdPrinterFormSource
  • wdPrinterLargeCapacityBin
  • wdPrinterLargeFormatBin
  • wdPrinterLowerBin
  • wdPrinterManualEnvelopeFeed
  • wdPrinterManualFeed
  • wdPrinterMiddleBin
  • wdPrinterOnlyBin
  • wdPrinterPaperCassette
  • wdPrinterSmallFormatBin
  • wdPrinterTractorFeed
  • wdPrinterUpperBin

AddressFromLeft Optional Variant. The distance (in points) between the left edge of the envelope and the recipient's address.

AddressFromTop Optional Variant. The distance (in points) between the top edge of the envelope and the recipient's address.

ReturnAddressFromLeft Optional Variant. The distance (in points) between the left edge of the envelope and the return address.

ReturnAddressFromTop Optional Variant. The distance (in points) between the top edge of the envelope and the return address.

DefaultFaceUp Optional Variant. True to print the envelope face up, False to print it face down.

DefaultOrientation Optional Variant. The orientation for the envelope. Can be one of the following WdEnvelopeOrientation constants: wdLeftPortrait, wdCenterPortrait, wdRightPortrait, wdLeftLandscape, wdCenterLandscape, wdRightLandscape, wdLeftClockwise, wdCenterClockwise, or wdRightClockwise.

See Also

AutoTextEntries property, Envelope property, InsertAutoText method, PrintOut method (Envelope object).

Example

This example inserts the formatted AutoText entry named "one" after the selection.

Selection.Collapse Direction:=wdCollapseEnd
ActiveDocument.AttachedTemplate.AutoTextEntries("one").Insert _
    Where:=Selection.Range, RichText:=True
This example adds a Size 10 envelope to the active document by using the addresses stored in the tAddr and fAddr variables.

rtn = VbCr
tAddr = "Max Benson" & rtn & "123 Skye St." & rtn & "OurTown, WA 98107"
fAddr = "Paul Borm" & rtn & "456 Erde Lane" & rtn & "OurTown, WA 98107"
ActiveDocument.Envelope.Insert Address:=fAddr, ReturnAddress:=tAddr, _
    Size:="Size 10"