美文网首页PPT设计~解锁新姿势
软件技能|Word三线表格式刷

软件技能|Word三线表格式刷

作者: 马骋 | 来源:发表于2016-04-26 19:37 被阅读234次

    问题描述

    将word中的标准表格设为论文常用的三线表格。

    解决方法

    Sub TablLine3()
        ' 三线表格式设置
        Selection.Borders(wdBorderTop).LineStyle = wdLineStyleNone
        Selection.Borders(wdBorderLeft).LineStyle = wdLineStyleNone
        Selection.Borders(wdBorderBottom).LineStyle = wdLineStyleNone
        Selection.Borders(wdBorderRight).LineStyle = wdLineStyleNone
        Selection.Borders(wdBorderHorizontal).LineStyle = wdLineStyleNone
        Selection.Borders(wdBorderVertical).LineStyle = wdLineStyleNone
        Selection.Borders(wdBorderDiagonalDown).LineStyle = wdLineStyleNone
        Selection.Borders(wdBorderDiagonalUp).LineStyle = wdLineStyleNone
     
        
        Options.DefaultBorderLineWidth = wdLineWidth100pt
        With Selection.Borders(wdBorderTop)
            .LineStyle = Options.DefaultBorderLineStyle
            .LineWidth = Options.DefaultBorderLineWidth
            .Color = Options.DefaultBorderColor
        End With
        Options.DefaultBorderLineWidth = wdLineWidth100pt
        With Selection.Borders(wdBorderBottom)
            .LineStyle = Options.DefaultBorderLineStyle
            .LineWidth = Options.DefaultBorderLineWidth
            .Color = Options.DefaultBorderColor
        End With
        
        Options.DefaultBorderLineWidth = wdLineWidth025pt
        With Selection.Rows(1).Borders(wdBorderBottom) '第一行的底边框
            .LineStyle = Options.DefaultBorderLineStyle
            .LineWidth = Options.DefaultBorderLineWidth
            .Color = Options.DefaultBorderColor
        End With
        
    End Sub
    

    使用示例

    • Alt + F11进入word VBA编程模块,将以上代码拷贝到此处;
      TabLine3.jpg-206.2kBTabLine3.jpg-206.2kB
    • Alt + F8进入宏运行选项;
    • 运行TabLine3;
      macro.jpg-193.2kBmacro.jpg-193.2kB
    • 处理结果;


      Demo.jpg-56.6kBDemo.jpg-56.6kB

    相关文章

      网友评论

        本文标题:软件技能|Word三线表格式刷

        本文链接:https://www.haomeiwen.com/subject/ixtcrttx.html