如果要通过CSS影响编辑器中的内容,可以通过Function DrawBorder(Rows As Long, Amount As Long)
Dim rng As Range
Dim WS As Worksheet
Dim firstRow As Long
Dim firstCol As Long
Dim lastRow As Long
Dim lastCol As Long
Let firstRow = 2
Let firstCol = 2
Let lastRow = Rows + 2
Let lastCol = 4
Set WS = Sheets("Sheet1")
Set rng = WS.Range("B" & firstRow & ":" & "D" & lastRow)
'Borders of the cells inside the range
rng.Borders.LineStyle = xlContinuous
'Border of the range as a whole with double lines
rng.Borders(xlEdgeTop).LineStyle = xlContinuous
rng.Borders(xlEdgeTop).Weight = xlThick
rng.Borders(xlEdgeBottom).LineStyle = xlContinuous
rng.Borders(xlEdgeBottom).Weight = xlThick
rng.Borders(xlEdgeLeft).LineStyle = xlContinuous
rng.Borders(xlEdgeLeft).Weight = xlThick
rng.Borders(xlEdgeRight).LineStyle = xlContinuous
rng.Borders(xlEdgeRight).Weight = xlThick
' Paste to multiple destinations
rng.Copy Destination:=Sheet1.Range("F" & firstRow & ":" & "H" & lastRow)
rng.Copy Destination:=Sheet1.Range("J" & firstRow & ":" & "L" & lastRow)
rng.Copy Destination:=Sheet1.Range("N" & firstRow & ":" & "P" & lastRow)
rng.Copy Destination:=Sheet1.Range("R" & firstRow & ":" & "T" & lastRow)
End Function
配置设置将CSS传递给编辑器:
https://www.tiny.cloud/docs/configure/content-appearance/#content_css