AppendToSpike 方法

       

删除指定的区域并将该区域的内容添至图文场(一个内置的“自动图文集”词条)。此方法将图文场作为一个 AutoTextEntry 对象返回。

expression.AppendToSpike(Range)

expression   必需。返回 AutoTextEntries 对象的表达式。

Range   Range 对象,必需。被删除和添至图文场的区域。

说明

AppendToSpike 方法仅对 Normal 模板中的 AutoTextEntries 有效。

示例

本示例删除选定内容并将其内容添至 Normal 模板的图文场中。

If Len(Selection.Range.Text) > 1 Then
    NormalTemplate.AutoTextEntries.AppendToSpike _
        Range:=Selection.Range
End If

本示例清除图文场,然后将活动文档中的第一个和第三个单词添至 Normal 模板的图文场中。同时在插入点插入图文场的内容。

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