View Single Post
 
Old 10-04-2013, 12:04 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

So I' think i've gotten quite close:

Code:
Option Explicit


Sub parenrows()
    Dim i As Long
    Dim c As Object
    With Selection
        If .Information(wdWithInTable) = False Then Exit Sub
        With .Tables(1)
            'Kill any existing borders
            .Borders(wdBorderTop).LineStyle = wdLineStyleNone
            .Borders(wdBorderLeft).LineStyle = wdLineStyleSingle
            .Borders(wdBorderBottom).LineStyle = wdLineStyleNone
            .Borders(wdBorderRight).LineStyle = wdLineStyleSingle
            .Borders(wdBorderHorizontal).LineStyle = wdLineStyleNone
            .Borders(wdBorderVertical).LineStyle = wdLineStyleNone
            For i = 1 To .Rows.Count
                For Each c In .Rows(i).Cells
                    ' Restore borders to every 2nd row
                    If InStr(c.Range.Cells, "(") > 0 Then
                        .Borders(wdBorderBottom).LineStyle = wdLineStyleSingle
                    End If
                Next c
            Next i
        End With
    End With
End Sub
the code bombs at the range.text portion.

Basically, i want to add a bottom line to any row with an open parentheses.

Thanks!

Last edited by hummus_it; 10-04-2013 at 01:59 PM.
Reply With Quote