閉じる

罫線を引く




'罫線を引く(見出しの位置から+10行分)

            Call make_Border(objEXCEL.Range(objEXCEL.Cells(nYLINE, nXLINE), _

                                      objEXCEL.Cells(nYLINE + 10, nXLINE + 1)))







Private Sub make_Border(objXY As Object)



    '罫線用のExcel定数(参照設定している場合は、必要無し)

    Const xlEdgeLeft = &H7

    Const xlEdgeRight = &HA

    Const xlEdgeTop = &H8

    Const xlEdgeBottom = &H9

    Const xlInsideVertical = &HB

    Const xlInsideHorizontal = &HC



    Const xlContinuous = &H1

    Const xlThin = &H2

    Const xlAutomatic = &HFFFFEFF7



    Dim n As Integer



    '配列に代入する

    Dim styleBOX As Variant

    styleBOX = Array(xlEdgeLeft, xlEdgeRight, xlEdgeTop _

                  , xlEdgeBottom, xlInsideVertical, xlInsideHorizontal)



    For n = 0 To 5 '各ラインに対して、値をセットする

        With objXY.Borders(styleBOX(n))

            .LineStyle = xlContinuous

            .Weight = xlThin

            .ColorIndex = xlAutomatic

        End With

    Next n



End Sub