Insert Method
Insert method as it applies to the AutoTextEntry object.
Inserts the AutoText entry in place of the specified range. Returns a Range object that represents the AutoText entry.
expression.Insert(Where, RichText)
expression Required. An expression that returns an AutoTextEntry object.
Where Required Range object. The location for the AutoText entry.
RichText Optional Variant. True to insert the AutoText entry with its original formatting.
Remarks
If you don't want to replace the range, use the Collapse method before using this method.
Insert method as it applies to the Envelope object.
Inserts an envelope as a separate section at the beginning of the specified document.
expression.Insert(ExtractAddress, Address, AutoText, OmitReturnAddress, ReturnAddress, ReturnAutoText, PrintBarCode, PrintFIMA, Size, Height, Width, FeedSource, AddressFromLeft, AddressFromTop, ReturnAddressFromLeft, ReturnAddressFromTop, DefaultFaceUp, DefaultOrientation, PrintEPostage, Vertical, RecipientNamefromLeft, RecipientNamefromTop, RecipientPostalfromLeft, RecipientPostalfromTop, SenderNamefromLeft, SenderNamefromTop, SenderPostalfromLeft, SenderPostalfromTop)
expression Required. An expression that returns an Envelope object.
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 not insert a 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 must match one of the sizes listed 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, measured in points, when the Size argument is set to "Custom size."
Width Optional Variant. The width of the envelope, measured in points, when the Size argument is set to "Custom size."
FeedSource Optional Variant. True to use the FeedSource property of the Envelope object to specify which paper tray to use when printing the envelope.
AddressFromLeft Optional Variant. The distance, measured in points, between the left edge of the envelope and the recipient's address.
AddressFromTop Optional Variant. The distance, measured in points, between the top edge of the envelope and the recipient's address.
ReturnAddressFromLeft Optional Variant. The distance, measured in points, between the left edge of the envelope and the return address.
ReturnAddressFromTop Optional Variant. The distance, measured 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 any WdEnvelopeOrientation constant.
wdLeftPortrait |
wdCenterPortrait |
wdRightPortrait |
wdLeftLandscape |
wdCenterLandscape |
wdRightLandscape |
wdLeftClockwise |
wdCenterClockwise |
wdRightClockwise |
PrintEPostage Optional Variant. True to insert postage from an Internet postage vendor.
Vertical Optional Variant. True to print vertical text on the envelope. Used for Asian envelopes. Default is False.
RecipientNamefromLeft Optional Variant. Position of the recipient's name, measured in points from the left edge of the envelope. Used for Asian envelopes.
RecipientNamefromTop Optional Variant. Position of the recipient's name, measured in points from the top edge of the envelope. Used for Asian envelopes.
RecipientPostalfromLeft Optional Variant. Position of the recipient's postal code, measured in points from the left edge of the envelope. Used for Asian envelopes.
RecipientPostalfromTop Optional Variant. Position of the recipient's postal code, measured in points from the top edge of the envelope. Used for Asian envelopes.
SenderNamefromLeft Optional Variant. Position of the sender's name, measured in points from the left edge of the envelope. Used for Asian envelopes.
SenderNamefromTop Optional Variant. Position of the sender's name, measured in points from the top edge of the envelope. Used for Asian envelopes.
SenderPostalfromLeft Optional Variant. Position of the sender's postal code, measured in points from the left edge of the envelope. Used for Asian envelopes.
SenderPostalfromTop Optional Variant. Position of the sender's postal code, measured in points from the top edge of the envelope. Used for Asian envelopes.
Insert method as it applies to the ShapeNodes object.
Inserts a node into a freeform shape.
expression.Insert(Index, SegmentType, EditingType, X1, Y1, X2, Y2, X3, Y3)
expression Required. An expression that returns a ShapeNodes object.
Index Required Long. The number of the shape node after which to insert a new node.
SegmentType Required MsoSegmentType. The type of line that connects the inserted node to the neighboring nodes.
MsoSegmentType can be one of these MsoSegmentType constants. |
msoSegmentLine |
msoSegmentCurve |
EditingType Required MsoEditingType. The editing property of the inserted node.
MsoEditingType can be one of these MsoEditingType constants. |
msoEditingAuto |
msoEditingCorner |
msoEditingSmooth |
msoEditingSymmetric |
X1 Required Single. If the EditingType of the new segment is msoEditingAuto, this argument specifies the horizontal distance, measured in points, from the upper-left corner of the document to the end point of the new segment. If the EditingType of the new node is msoEditingCorner, this argument specifies the horizontal distance, measured in points, from the upper-left corner of the document to the first control point for the new segment.
Y1 Required Single. If the EditingType of the new segment is msoEditingAuto, this argument specifies the vertical distance, measured in points, from the upper-left corner of the document to the end point of the new segment. If the EditingType of the new node is msoEditingCorner, this argument specifies the vertical distance, measured in points, from the upper-left corner of the document to the first control point for the new segment.
X2 Optional Single. If the EditingType of the new segment is msoEditingCorner, this argument specifies the horizontal distance, measured in points, from the upper-left corner of the document to the second control point for the new segment. If the EditingType of the new segment is msoEditingAuto, don't specify a value for this argument.
Y2 Optional Single. If the EditingType of the new segment is msoEditingCorner, this argument specifies the vertical distance, measured in points, from the upper-left corner of the document to the second control point for the new segment. If the EditingType of the new segment is msoEditingAuto, don't specify a value for this argument.
X3 Optional Single. If the EditingType of the new segment is msoEditingCorner, this argument specifies the horizontal distance, measured in points, from the upper-left corner of the document to the end point of the new segment. If the EditingType of the new segment is msoEditingAuto, don't specify a value for this argument.
Y3 Optional Single. If the EditingType of the new segment is msoEditingCorner, this argument specifies the vertical distance, measured in points, from the upper-left corner of the document to the end point of the new segment. If the EditingType of the new segment is msoEditingAuto, don't specify a value for this argument.
Example
As it applies to the AutoTextEntry object.
This example inserts the formatted AutoText entry named "one" after the selection.
Sub InsertAutoTextEntry()
ActiveDocument.Content.Select
Selection.Collapse Direction:=wdCollapseEnd
ActiveDocument.AttachedTemplate.AutoTextEntries("one").Insert _
Where:=Selection.Range, RichText:=True
End Sub
As it applies to the Envelope object.
This example adds a Size 10 envelope to the active document by using the addresses stored in the strAddr
and strReturnAddr
variables.
Sub InsertEnvelope()
Dim strAddr As String
Dim strReturnAddr As String
strAddr = "Max Benson" & vbCr & "123 Skye St." _
& vbCr & "OurTown, WA 98107"
strReturnAddr = "Paul Borm" & vbCr & "456 Erde Lane" _
& vbCr & "OurTown, WA 98107"
ActiveDocument.Envelope.Insert Address:=strAddr, _
ReturnAddress:=strReturnAddr, Size:="Size 10"
End Sub
As it applies to the ShapeNodes object.
This example selects the third shape in the active document, checks whether the shape is a Freeform object, and if it is, inserts a node.
Sub InsertShapeNode()
ActiveDocument.Shapes(3).Select
With Selection.ShapeRange
If .Type = msoFreeform Then
.Nodes.Insert _
Index:=3, SegmentType:=msoSegmentCurve, _
EditingType:=msoEditingSymmetric, x1:=35, y1:=100
.Fill.ForeColor.RGB = RGB(0, 0, 200)
.Fill.Visible = msoTrue
Else
MsgBox "This shape is not a Freeform object."
End If
End With
End Sub