Search This Blog

Friday, June 27, 2014

Convert all Tables to Text

Because I just spent (too much) time looking for this, I am hoping this blog post will be easier to find.
http://howto.wikispaces.umb.edu/Convert+all+tables+to+text
Sometimes you need to remove or convert tables in order to process your content in another tool. Word has no automatic "convert all tables to text" feature, so to avoid selecting and converting each table by hand, you'll need to use a macro like this. Simple paste the following code into a new macro (from Word 2007's Developer Tab, which you can enable in Word Options).

Sub AllTablestoText()
'
' AllTablestoText Macro
' Macro created by Jarosław Michalak
'
For Each aTable In ActiveDocument.Tables

aTable.ConvertToText wdSeparateByCommas, True

Next aTable

End Sub


Macro written by Jaroslaw Michalak from the ProZ Forums. He notes:

If you need another separator, you might replace the "wdSeparateByTabs" parameter with:
wdSeparateByDefaultListSeparator
wdSeparateByParagraphs
wdSeparateByCommas
or even put a custom separator:
aTable.ConvertToText "*", True

No comments: