Word macro to extract tables from a WORD document

  • Thread starter Generic Usenet Account
  • Start date

G

Generic Usenet Account

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
 
Ad

Advertisements

J

Jay Freedman

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top