M
mmikedm1000
Hi, I am tring to have a macro remove table borders from all the tables in
an active document. This is the code I came up with, but it has some errors
I cannot fix.
Sub tableNoBorder()
Dim oTable As table
For Each oTable In ActiveDocument.Tables
oTable.Style = "Table Style1"
Next oTable
'
' Removes Table Borders
'
Dim oTbl As table
For Each oTbl In ActiveDocument.Tables
With oTbl.Borders
.Borders(wdBorderLeft).LineStyle = wdLineStyleNone
.Borders(wdBorderRight).LineStyle = wdLineStyleNone
.Borders(wdBorderTop).LineStyle = wdLineStyleNone
.Borders(wdBorderBottom).LineStyle = wdLineStyleNone
.Borders(wdBorderHorizontal).LineStyle = wdLineStyleNone
.Borders(wdBorderVertical).LineStyle = wdLineStyleNone
.Borders(wdBorderDiagonalDown).LineStyle = wdLineStyleNone
.Borders(wdBorderDiagonalUp).LineStyle = wdLineStyleNone
.Borders.Shadow = False
End With
On Error Resume Next
With Options
.DefaultBorderLineStyle = wdLineStyleSingle
.DefaultBorderLineWidth = wdLineWidth050pt
.DefaultBorderColor = wdColorAutomatic
End With
Next oTbl
End Sub
Any suggestions? Oh, the reason I am doing this is becuase I am importing
these documents to RoboHTML and it does not recognize the tables correctly.
an active document. This is the code I came up with, but it has some errors
I cannot fix.
Sub tableNoBorder()
Dim oTable As table
For Each oTable In ActiveDocument.Tables
oTable.Style = "Table Style1"
Next oTable
'
' Removes Table Borders
'
Dim oTbl As table
For Each oTbl In ActiveDocument.Tables
With oTbl.Borders
.Borders(wdBorderLeft).LineStyle = wdLineStyleNone
.Borders(wdBorderRight).LineStyle = wdLineStyleNone
.Borders(wdBorderTop).LineStyle = wdLineStyleNone
.Borders(wdBorderBottom).LineStyle = wdLineStyleNone
.Borders(wdBorderHorizontal).LineStyle = wdLineStyleNone
.Borders(wdBorderVertical).LineStyle = wdLineStyleNone
.Borders(wdBorderDiagonalDown).LineStyle = wdLineStyleNone
.Borders(wdBorderDiagonalUp).LineStyle = wdLineStyleNone
.Borders.Shadow = False
End With
On Error Resume Next
With Options
.DefaultBorderLineStyle = wdLineStyleSingle
.DefaultBorderLineWidth = wdLineWidth050pt
.DefaultBorderColor = wdColorAutomatic
End With
Next oTbl
End Sub
Any suggestions? Oh, the reason I am doing this is becuase I am importing
these documents to RoboHTML and it does not recognize the tables correctly.