View Single Post
 
Old 07-18-2017, 09:11 AM
Alvaro.passi Alvaro.passi is offline Windows 10 Office 2016
Novice
 
Join Date: Jul 2017
Posts: 6
Alvaro.passi is on a distinguished road
Exclamation VBA color of visible gridlines of tables word (with some merged cells in first rows)

I have more than 500 tables in Word. All of them have horizontal green borders at the top and bottom of the table, and some horizontal lines inside the table. Because of a mistake, some lines inside the same table and between tables have different green colors.
All the tables have merged cell in the first row. Tables have diferent numbers of rows and columns.

I need to unify the color of visible borders of all tables to the same green (RGB:0,128,0).

I'm very new with VBA. I have been looking at this for weeks without any success.

Attached is an example of the tables in my word document.

Someone give me this code, but only works with the first top border:

Sub colorBorders()
Dim i As Integer
Dim tabl As Table
For Each tabl In ActiveDocument.Tables ' iterate all the tables
For i = 1 To tabl.Borders.Count ' iterate all borders for each table
tabl.Borders(i).Color = RGB(0, 128, 0)
Next i
Next tabl
End Sub
Attached Files
File Type: docx Tablas para subir a foro.docx (20.5 KB, 14 views)
Reply With Quote