本示例在所选单元格的左侧插入新单元格,然后为选定的单元格添加红色的单线边框。

If Selection.Cells.Count >= 1 Then
    Selection.InsertCells ShiftCells:=wpsInsertCellsShiftRight
    For Each aBorder In Selection.Borders
        aBorder.LineStyle = wpsLineStyleSingle
        aBorder.Color = wpsColorRed
    Next aBorder
End If