+ Reply to Thread
Results 1 to 3 of 3

Extract All Tables From a Word Document Into Excel

  1. #1
    Forum Contributor
    Join Date
    12-28-2015
    Location
    US
    MS-Off Ver
    365
    Posts
    133

    Extract All Tables From a Word Document Into Excel

    I am looking to extract only tables from a ms word document. See attached workbook for examples and further details.

    The challenge with my current method is that with most (if not all) code for taking tables from word to excel, there's an alignment issue with headers. I have my own code to deal will all the merged and misaligned data in the body of the table, but without the headers in some pattern their original state cannot be put back together. I've looked through other code example such as (see below) and the list goes on, but none remedy the header issue. in the end, I am putting this data into a database and need there to be some semblance of order.

    other code references.
    https://www.excelvbasolutions.com/20...-to-excel.html
    https://stackoverflow.com/questions/...-word-to-excel
    https://www.mrexcel.com/board/thread...-excel.984236/
    https://stackoverflow.com/questions/...o-excel-sheets


    Basically, looking to have vba run though a word doc and extract all it's tables and place them on one sheet in excel with some type of separator between them (yellow line, doesn't matter).

    happy new year's and thanks in advance (stay safe). thanks!
    Attached Files Attached Files

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Extract All Tables From a Word Document Into Excel

    Can you post the code for your current method?
    If posting code please use code tags, see here.

  3. #3
    Forum Contributor
    Join Date
    12-28-2015
    Location
    US
    MS-Off Ver
    365
    Posts
    133

    Re: Extract All Tables From a Word Document Into Excel

    Below is portion of the code. there are hundreds of lines since there so many exceptions and clean up that's being done on the tables that come over.
    I have added a new example to the workbook (if that's helpful).


    then there are a series of formula tests that are done and depending if arguments are TRUE/FALSE then more macros and other type of clean up macros are run.

    because the body of the table can be cleaned by "simply" running and re-running clean up macros, the body ends up in a good place, however the headers are random
    when using available, published extraction methods.

    so the burning question is whether there's another extraction method that preserves headers better or one needs to be built.

    Please Login or Register  to view this content.
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Extract Word header table data to excel (closed word document)
    By Yakov on Excel in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-14-2017, 02:12 PM
  2. Replies: 0
    Last Post: 07-12-2015, 06:17 AM
  3. Replies: 1
    Last Post: 10-10-2013, 10:53 AM
  4. Macro to copy data within excel into tables in a word document
    By tanweercwa in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-14-2013, 07:50 AM
  5. Macro to copy data within excel into tables in a word document
    By dapsef in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-04-2013, 02:24 PM
  6. Macro to copy data within excel into tables in a word document
    By rpt21 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 07-27-2012, 05:33 AM
  7. Replies: 0
    Last Post: 08-30-2005, 11:05 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1