AutoTextEntries.AppendToSpike Method (Word)
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. A variable that represents an AutoTextEntries collection.
Parameters
Name |
Required/Optional |
Data Type |
Description |
---|---|---|---|
Range |
Required |
Range |
The range that's deleted and appended to the Spike. |
Return Value
AutoTextEntry
Remarks
The AppendToSpike method is only valid for the AutoTextEntries collection in the Normal template.
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 Normal template. The contents of the Spike are then inserted at the insertion point.
Dim atEntry As AutoTextEntry
Selection.Collapse Direction:=wdCollapseStart
For Each atEntry In NormalTemplate.AutoTextEntries
If atEntry.Name = "Spike" Then atEntry.Delete
Next atEntry
With NormalTemplate.AutoTextEntries
.AppendToSpike Range:=ActiveDocument.Words(3)
.AppendToSpike Range:=ActiveDocument.Words(1)
.Item("Spike").Insert Where:=Selection.Range
End With