-
Border in word table with vertically merged cells
Hello,
I am trying to have a macro button on my toolbar that will place a thick gray border on the top of the row my cursor is in. I am running into an error that states:
"Run-time error '5991'
Cannot access individual rows in this collection because the table has vertically merged cells."
This is a very helpful error code, but I don't know how to fix my code to avoid this problem. This error occurs even if my cursor is not in a row that contains merged cells, but somewhere else in the table does.
This is my code:
Private Sub darkborderrow()
Dim oRow As Row
Set oRow = Selection.Rows(1)
With oRow.Range.Borders(wdBorderTop)
.LineStyle = wdLineStyleSingle
.LineWidth = wdLineWidth300pt
.Color = wdColorGray60
End With
End Sub
I will also attach a sample document with tables and code that this problem would occur with incase that would be helpful.
Border Failure Examples.docm
Thank you for all of your help,
Emily
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules