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

See also

AutoTextEntries Collection Object

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.