边框

动作开发 · 403 次浏览
用户BfzjIYJoBAA 创建于 2023-12-07 18:52

能不能制作一个动作,上下粗边框1.5磅,左右无边框,中间是细虚线,类似下面这样。


回复内容
CL 2023-12-07 19:06
#1

可以尝试录制一个VBA宏,然后转换为动作,参考:示例:录制VBA宏并转换为动作 - by CL - 动作信息 - Quicker 

之乎者也吧 2023-12-08 15:31
#2

来自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编辑器中,然后运行该宏即可实现所需的效果。


回复主贴