AppendToSpike Method

Applies To

AutoTextEntries collection object.

Description

Deletes the specified range and adds the contents of the range to the Spike (a built-in AutoText entry). This method returns the Spike as an AutoTextEntry object.

Syntax

expression.AppendToSpike(Range)

expression Required. An expression that returns an AutoTextEntries object.

Range Required Range object. The range that's deleted and appended to the Spike.

See Also

AutoTextEntry object, Cut method, Insert method.

Example

This example deletes the selection and adds its contents to the Spike in the Normal template.

If Len(Selection.Range.Text) > 1 Then
    NormalTemplate.AutoTextEntries.AppendToSpike _
        Range:=Selection.Range
End If
This example clears the Spike and adds the first and third words in the active document to the Spike in the attached template. The contents of the Spike are then inserted at the insertion point.

Selection.Collapse Direction:=wdCollapseStart
Set myTemplate = ActiveDocument.AttachedTemplate
For Each entry In myTemplate.AutoTextEntries
    If entry.Name = "Spike" Then entry.Delete
Next entry
With myTemplate.AutoTextEntries
    .AppendToSpike Range:=ActiveDocument.Words(3)
    .AppendToSpike Range:=ActiveDocument.Words(1)
    .Item("Spike").Insert Where:=Selection.Range
End With