Word macro to extract tables from a WORD document

Discussion in 'Word Programming' started by Generic Usenet Account, May 10, 2011.

  1. Hi,

    Can someone out there kindly provide a word macro that extracts all
    the tables in a WORD document into a separate document, with a blank
    like separating the tables?

    Thanks in advance!
    Choi
     
    Generic Usenet Account, May 10, 2011
    #1
    1. Advertisements

  2. Generic Usenet Account

    Jay Freedman Guest

    On Tue, 10 May 2011 10:14:48 -0700 (PDT), Generic Usenet Account
    <> wrote:

    >Hi,
    >
    >Can someone out there kindly provide a word macro that extracts all
    >the tables in a WORD document into a separate document, with a blank
    >like separating the tables?
    >
    >Thanks in advance!
    >Choi


    Sub ExtractTables()
    Dim src As Document
    Dim dst As Document
    Dim tbl As Table
    Dim rg As Range

    Set src = ActiveDocument
    Set dst = Documents.Add

    For Each tbl In src.Tables
    Set rg = dst.Range
    rg.Collapse wdCollapseEnd
    rg.FormattedText = tbl.Range.FormattedText
    rg.Collapse wdCollapseEnd
    rg.Text = vbCr
    Next
    End Sub

    --
    Regards,
    Jay Freedman
    Microsoft Word MVP
    Email cannot be acknowledged; please post all follow-ups to the newsgroup so all may benefit.
     
    Jay Freedman, May 11, 2011
    #2
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Doctorjones_md
    Replies:
    9
    Views:
    132
    Jean-Guy Marcil
    Nov 16, 2006
  2. Mr Anderson

    extract text from table

    Mr Anderson, Feb 2, 2007, in forum: Word Programming
    Replies:
    1
    Views:
    125
    Perry
    Feb 3, 2007
  3. miztaken
    Replies:
    0
    Views:
    150
    miztaken
    May 9, 2008
  4. Hafeez Esmail

    Programatically extract selected data (and structure)

    Hafeez Esmail, Jun 5, 2008, in forum: Word Programming
    Replies:
    1
    Views:
    83
    Cindy M.
    Jun 8, 2008
  5. henry
    Replies:
    4
    Views:
    225
    henry
    Jul 19, 2008
  6. Jethro

    Extract Bitmap from inlineshape object

    Jethro, Sep 12, 2008, in forum: Word Programming
    Replies:
    3
    Views:
    282
    Jethro
    Sep 12, 2008
  7. Replies:
    1
    Views:
    153
    Graham Mayor
    Jan 16, 2009
  8. Replies:
    0
    Views:
    525
Loading...