Wednesday 5 September 2018

Word - Converting Tables to Text

Tables are a great boon to users of Word. When you are working with documents that were created in a different Word processor, however, tables can be a nuisance. For instance, Steve complained that his two-column text created in WordPerfect was converted in Word to tables. He asked for a way to automatically convert all the tables to text, without the need to process each table manually.
The following macro, AllTablesToText, will do the trick. It steps through each table in the current document and converts them all to text, with tabs between columns:
Sub AllTablesToText()
    Dim t As Table

    For Each t in ActiveDocument.Tables
        t.ConvertToText Separator:=wdSeparateByTabs
    Next t
End Sub
If you don't want tabs between columns, all you need to do is change the value assigned to the Separator parameter. You can use wdSeparateByCommas, wdSeparateByDefaultListSeparator, or wdSeparateByParagraphs.

No comments:

Post a Comment