如何用VB操作Excel的表头,表尾。如何将一个Excel中的一页表格行全部加上表格线(预览时显示表格线)  最好有例子:)

解决方案 »

  1.   

    With xlSheet
                .Range(.Cells(1, 1), .Cells(1, 9)).Font.Name = "黑体"
                '设标题为黑体字
                .Range(.Cells(1, 1), .Cells(1, 9)).Font.Bold = True
                '标题字体加粗
                .Range(.Cells(1, 1), .Cells(1, 9)).Borders.LineStyle = xlContinuous
                '设表格边框样式
            End With
      

  2.   

    With app.ActiveSheet.PageSetup
        .LeftHeader = ""
        .CenterHeader = ""
        .RightHeader = ""
        .LeftFooter = ""
        .CenterFooter = ""
        .RightFooter = ""
        .LeftMargin = app.Application.InchesToPoints(0.354330708661417)
        .RightMargin = app.Application.InchesToPoints(0.354330708661417)
        .TopMargin = app.Application.InchesToPoints(0.196850393700787)
        .BottomMargin = app.Application.InchesToPoints(0.196850393700787)
        .HeaderMargin = app.Application.InchesToPoints(0.118110236220472)
        .FooterMargin = app.Application.InchesToPoints(0.118110236220472)
        .PrintHeadings = False
        .PrintGridlines = False
        .PrintComments = xlPrintNoComments
        .PrintQuality = 600
        .CenterHorizontally = True
        .CenterVertically = True
        .Orientation = xlPortrait
        .Draft = False
        .PaperSize = xlPaperA4
        .FirstPageNumber = xlAutomatic
        .order = xlDownThenOver
        .BlackAndWhite = False
        .Zoom = 100
    End With
    告訴你一招﹐在excel里錄制宏----把你想要得到的效果在excel里操作一遍﹐錄下操作的宏﹐在編輯中看看這些宏﹐你就知道該這么做了 (copy ---->paste)