AutoTextEntries.AppendToSpike 方法(Word)AutoTextEntries.AppendToSpike method (Word)

會刪除指定的範圍並將該範圍的內容新增至特殊圖文集 (內建的自動圖文集項目)。Deletes the specified range and adds the contents of the range to the Spike (a built-in AutoText entry). 這個方法會將波峰視為AutoTextEntry物件。This method returns the Spike as an AutoTextEntry object.


expressionexpression. AppendToSpike( _Range_ )AppendToSpike( _Range_ )

需要 expressionexpression Required. 代表 'AutoTextEntries' 集合的變數。A variable that represents an 'AutoTextEntries' collection.


名稱Name 必要/選用Required/Optional 資料類型Data type 描述Description
RangeRange 必要Required RangeRange 已刪除並附加至特殊圖文集的範圍。The range that's deleted and appended to the Spike.

傳回值Return value



AppendToSpike 方法才有效 Normal 範本中的 AutoTextEntries 集合。The AppendToSpike method is only valid for the AutoTextEntries collection in the Normal template.


這則範例會刪除選取項目並將其內容加入至 Normal 範本中的特殊圖文集。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 _ 
End If

這則範例會清除特殊圖文集並將使用中文件內的第一個和第三個字加入至 Normal 範本中的特殊圖文集。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 集合物件AutoTextEntries Collection Object

支援和意見反應Support and feedback

有關於 Office VBA 或這份文件的問題或意見反應嗎?Have questions or feedback about Office VBA or this documentation? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.