Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am in a situation where I need to make a HTML report into a word report with nothing more that Ctrl+C or opening it with Word. I end up with a lot of nested tables.

Problem lies in the fact that CSS formats the table in HTML while in Word document they are left with horrible looking borders, that need to be invisible.

It would take extensive amounts of time to make each tables borders invisible.

Is there a way to make all borders of every table in document invisible?

share|improve this question
Or, maybe, someone knows how to keep CSS formatting. – TheBW Nov 6 '12 at 17:07
up vote 2 down vote accepted

Create a macro in Word using the following code:

Sub SelectAllTables()
    Dim tbl As Table
    Application.ScreenUpdating = False
    For Each tbl In ActiveDocument.Tables
        tbl.Range.Editors.Add wdEditorEveryone
    ActiveDocument.SelectAllEditableRanges (wdEditorEveryone)
    ActiveDocument.DeleteAllEditableRanges (wdEditorEveryone)
    Application.ScreenUpdating = True
End Sub

Run the macro to select all tables, then you can modify their borders in one go:


Edit: Ok, this should be able to recursively handle nested tables as well to any level:

Sub SelectAllTables()
    Dim tbl As Table
    For Each tbl In ActiveDocument.Tables
        DelTableBorder tbl
End Sub

Function DelTableBorder(tbl As Table)
    Dim itbl As Table
    tbl.Borders(wdBorderLeft).Visible = False
    tbl.Borders(wdBorderRight).Visible = False
    tbl.Borders(wdBorderTop).Visible = False
    tbl.Borders(wdBorderBottom).Visible = False
    tbl.Borders(wdBorderVertical).Visible = False
    tbl.Borders(wdBorderHorizontal).Visible = False
    tbl.Borders(wdBorderDiagonalUp).Visible = False
    tbl.Borders(wdBorderDiagonalDown).Visible = False
    For Each itbl In tbl.Tables
        DelTableBorder itbl
End Function
share|improve this answer
While the macro is working perfectly, It seams that selecting "No borders" option only removes border of main table, not nested tables, which is the biggest issue here. Still, thank you. – TheBW Nov 7 '12 at 9:17
@TheBW: Came up with the alternate version above. I'm no VBA expert and it looks ugly, but hopefully it should solve your issue. – Karan Nov 7 '12 at 16:11

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.