View Single Post
 
Old 10-03-2013, 02:25 PM
hummus_it hummus_it is offline Windows 7 64bit Office 2013
Novice
 
Join Date: Oct 2013
Posts: 3
hummus_it is on a distinguished road
Default Adding a border to every nth row of a word table

Hi All,

I found some very helpful code on this forum to edit add borders to a table in word via vba.

Now, I'd like to tweak that code to add a horizontal border to only every nth row. If possible, i'd like to even specify at which row after the top border to start counting.

Here is my code:
Code:
Sub modifyactivetable()
Dim oTbl
With ActiveDocument
  Set oTbl = Selection.Tables(1)
  With oTbl
    .Borders(wdBorderTop).LineStyle = wdLineStyleSingle
    .Borders(wdBorderLeft).LineStyle = wdLineStyleSingle
    .Borders(wdBorderBottom).LineStyle = wdLineStyleSingle
    .Borders(wdBorderRight).LineStyle = wdLineStyleSingle
    .Borders(wdBorderHorizontal).LineStyle = wdLineStyleSingle
    .Borders(wdBorderVertical).LineStyle = wdLineStyleSingle
    '.Borders(wdBorderDiagonalDown).LineStyle = wdLineStyleSingle
    '.Borders(wdBorderDiagonalUp).LineStyle = wdLineStyleSingle
  End With
End With
Set oTbl = Nothing
End Sub
I'd like to modify the horizontal line statement so that it only takes hold for every other row.
Reply With Quote