本示例激活选中域的域底纹功能,插入 DATE 域,然后将所选内容向左移动,以选定该域。

ActiveDocument.ActiveWindow.View.FieldShading = _
    wpsFieldShadingWhenSelected
With Selection
    .Fields.Add Range:=Selection.Range, Type:=wpsFieldDate
    .MoveLeft Unit:=wpsWord, Count:=1
End With