Configurando Bordas de Tabelas no WORD (Padrão ABNT) automaticamente

Опубликовано: 25 Февраль 2026
на канале: Canog Tutoriais
59
2

Pessoal, basta COPIAR e COLAR o Código abaixo:

Sub ConfigurarTabelasABNT()
Dim tabela As Table
Dim i As Integer

' 1
For Each tabela In ActiveDocument.Tables
' 2
With tabela.Borders(wdBorderLeft)
.LineStyle = wdLineStyleNone
End With
With tabela.Borders(wdBorderRight)
.LineStyle = wdLineStyleNone
End With

' 3
tabela.Borders(wdBorderVertical).LineStyle = wdLineStyleNone

' 4
tabela.Borders(wdBorderHorizontal).LineStyle = wdLineStyleNone

' 5
With tabela.Rows(1).Borders(wdBorderBottom)
.LineStyle = wdLineStyleSingle
.LineWidth = wdLineWidth050pt
.Color = RGB(0, 0, 0)
End With

' 6
With tabela.Rows(tabela.Rows.Count).Borders(wdBorderBottom)
.LineStyle = wdLineStyleSingle
.LineWidth = wdLineWidth050pt
.Color = RGB(0, 0, 0)
End With

Next tabela

End Sub


_____________________

Caso preferir colocar a borda superior horizontal na última linha da tabela:

Sub ConfigurarTabelasABNT()
Dim tabela As Table
Dim i As Integer

' 1
For Each tabela In ActiveDocument.Tables
' 2
With tabela.Borders(wdBorderLeft)
.LineStyle = wdLineStyleNone
End With
With tabela.Borders(wdBorderRight)
.LineStyle = wdLineStyleNone
End With

' 3
tabela.Borders(wdBorderVertical).LineStyle = wdLineStyleNone

' 4
tabela.Borders(wdBorderHorizontal).LineStyle = wdLineStyleNone

' 5
With tabela.Rows(1).Borders(wdBorderBottom)
.LineStyle = wdLineStyleSingle
.LineWidth = wdLineWidth050pt
.Color = RGB(0, 0, 0)
End With

' 6
With tabela.Rows(tabela.Rows.Count).Borders(wdBorderBottom)
.LineStyle = wdLineStyleSingle
.LineWidth = wdLineWidth050pt
.Color = RGB(0, 0, 0)
End With
With tabela.Rows(tabela.Rows.Count).Borders(wdBorderTop)
.LineStyle = wdLineStyleSingle
.LineWidth = wdLineWidth050pt
.Color = RGB(0, 0, 0)
End With

Next tabela

End Sub