Copying All Tables to a New Document

Written by Allen Wyatt (last updated December 26, 2020)
This tip applies to Word 2007, 2010, 2013, 2016, 2019, and Word in Microsoft 365


1

Tables are a great way to present many types of information. In fact, I've seen some documents that consist almost entirely of tables. If you do a lot of work with tables, you may (at some point) want to copy all the tables from one document to a brand-new document. This could be helpful if you have tabular information that needs to be available in the new document, but you don't need the rest of the information from the original document.

The easiest way to do this type of copying is by using a macro. Fortunately, all the tables in a document are made available to VBA through the Tables collection. That means you can step through each item in the collection (each item will be an individual table) and then copy it.

Sub CopyTables()
    Dim Source As Document
    Dim Target As Document
    Dim tbl As Table
    Dim tr As Range

    Set Source = ActiveDocument
    Set Target = Documents.Add

    For Each tbl In Source.Tables
        Set tr = Target.Range
        tr.Collapse wdCollapseEnd
        tr.FormattedText = tbl.Range.FormattedText
        tr.Collapse wdCollapseEnd
        tr.Text = vbCrLf
    Next
End Sub

The macro, once run, creates a brand-new document (Target) and copies the tables from the original document (Source) into the new one. (The source document is whatever document was active when you ran the macro.) The macro places a blank line between each table in the Target document. If you don't want the blank line, then remove or comment out the line just before the Next statement.

Note:

If you would like to know how to use the macros described on this page (or on any other page on the WordTips sites), I've prepared a special page that includes helpful information. Click here to open that special page in a new browser tab.

WordTips is your source for cost-effective Microsoft Word training. (Microsoft Word is the most popular word processing software in the world.) This tip (13338) applies to Microsoft Word 2007, 2010, 2013, 2016, 2019, and Word in Microsoft 365.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Saving a Workbook with a Preview

When you save your workbooks, Excel can also save a preview image (thumbnail) that can be displayed in the Open dialog ...

Discover More

Drop-Down List Font Sizes

Excel has several features that cannot be customized. The font size in the drop-down lists is one of them. If you need ...

Discover More

Formatting Canadian Postal Codes

Postal codes in Canada consist of six characters, separated into two groups. This tip explains the format and then shows ...

Discover More

Comprehensive VBA Guide Visual Basic for Applications (VBA) is the language used for writing macros in all Office programs. This complete guide shows both professionals and novices how to master VBA in order to customize the entire Office suite for their needs. Check out Mastering VBA for Office 2010 today!

More WordTips (ribbon)

Freezing Cell Size when Inserting Pictures

Insert a picture into a table cell, and you may quickly find that the table is no longer the size you expected. Here's ...

Discover More

Quickly Moving Your Table

For those who love to use the mouse during editing, you can use the little critter to help move your tables to exactly ...

Discover More

Locking Table Contents

When you get information in your document "just right," you may want to make sure that others cannot change it. Here's a ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] (all 7 characters, in the sequence shown) in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is one less than 9?

2023-05-02 19:56:56

Melissa

Hi There, What if I would like to only copy one table's certain column and row instead of all tables?


This Site

Got a version of Word that uses the ribbon interface (Word 2007 or later)? This site is for you! If you use an earlier version of Word, visit our WordTips site focusing on the menu interface.

Videos
Subscribe

FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.