来自GPT的回答:
可以使用以下VBA代码来实现对Word文档的上下粗边框和中间细虚线的效果:
Sub AddCustomBorders()
Dim myRange As Range
Set myRange = ActiveDocument.Range
myRange.Select
' 设置上下粗边框
With Selection.Borders(wdBorderTop)
.LineStyle = wdLineStyleDouble
.LineWidth = wdLineWidth150pt
End With
With Selection.Borders(wdBorderBottom)
.LineStyle = wdLineStyleDouble
.LineWidth = wdLineWidth150pt
End With
' 设置中间细虚线
With Selection.Borders(wdBorderLeft)
.LineStyle = wdLineStyleNone
End With
With Selection.Borders(wdBorderRight)
.LineStyle = wdLineStyleNone
End With
With Selection.Borders(wdBorderVertical)
.LineStyle = wdLineStyleDot
.LineWidth = wdLineWidth050pt
End With
End Sub
将以上代码复制粘贴到Word VBA编辑器中,然后运行该宏即可实现所需的效果。