+ Reply to Thread
Results 1 to 4 of 4

Extracting Data from Word Table to Excel 2013 into specific columns

  1. #1
    Registered User
    Join Date
    03-14-2017
    Location
    Toronto, Canada
    MS-Off Ver
    13
    Posts
    3

    Extracting Data from Word Table to Excel 2013 into specific columns

    Hello.

    First many thanks for the assistance of this group and Macropod who has helped me to get started via previous posts and to navigate and understand rules of the forum.

    I have the basics of the code working, thanks again to Macropod's previous posts.

    My issues with the original code is that
    (1) it only brings in the first 4 items in the document.
    (2) it doesn't check and extract data from multiple docs in the same folder

    Once I have those resolved the basics are in place.

    (3) In addition to bringing in the data from a Word doc to Excel (2013) I am looking to have the data populate specific columns in the excel spreadsheet according to the master Excel spreadsheet.

    https://www.dropbox.com/sh/nf0og7evr...FIke6jaFa?dl=0

    In that link I have provided:
    -2 data entry forms with data (WORD)
    -Master data entry form that shows all fields and the corresponding column in Excel where it should populate in table format (WORD)
    -Spreadsheet sample used to create the master sheet and identify corresponding columns (EXCEL)
    -code used that extracts the first 4 lines of only one doc in the folder (TXT)

    Many thanks, your assistance is much appreciated.

    I am using this forum as my ongoing discussion on the topic.

    Please note I had also originally posted this discussion here:
    Cross posting reference: https://social.technet.microsoft.com...013?forum=word

  2. #2
    Forum Expert macropod's Avatar
    Join Date
    12-22-2011
    Location
    Canberra, Australia
    MS-Off Ver
    Word, Excel & Powerpoint 2003 & 2010
    Posts
    3,726

    Re: Extracting Data from Word Table to Excel 2013 into specific columns

    Assuming there's only one table per document to process, try:
    Please Login or Register  to view this content.
    With this code, it doesn't matter which rows are present in, or absent from, a given table; provided there is a match between the title on a row and a given column name, any data that are present will be output to the corresponding Excel column.
    Last edited by macropod; 03-15-2017 at 10:54 PM. Reason: Bug fix
    Cheers,
    Paul Edstein
    [Fmr MS MVP - Word]

  3. #3
    Registered User
    Join Date
    03-14-2017
    Location
    Toronto, Canada
    MS-Off Ver
    13
    Posts
    3

    Re: Extracting Data from Word Table to Excel 2013 into specific columns

    Hello Paul,

    I thought I had posted an answer here, but I don't see it now. I see you posted in the cross referenced post as well, which is great.

    What I wrote in the other forum:

    This worked flawlessly, thank you very much! I really appreciate this.

    Learning question: If I wanted to add a third column for description purposes (two columns in the original file), but still have the excel sheet only pull data from the last column, where would I look to make this change?

    Again, thank you so much! I don't know how to express my gratitude in a way that will come through in this forum

    Kind regards,

    Evelyn

  4. #4
    Forum Expert macropod's Avatar
    Join Date
    12-22-2011
    Location
    Canberra, Australia
    MS-Off Ver
    Word, Excel & Powerpoint 2003 & 2010
    Posts
    3,726

    Re: Extracting Data from Word Table to Excel 2013 into specific columns

    Assuming the new column is to go between the existing two, you could change:
    xlWkSht.Cells(lRow, c).Value = Split(.Cell(r, 2).Range.Text, vbCr)(0)
    to:
    xlWkSht.Cells(lRow, c).Value = Split(.Cell(r, 3).Range.Text, vbCr)(0)

    If the new column is to go before the existing two, you would also need to change:
    strTmp = Split(.Cell(r, 1).Range.Text, vbCr)(0)
    to:
    strTmp = Split(.Cell(r, 2).Range.Text, vbCr)(0)

    If the new column is to go after the existing two, you don't need to make any changes.

+ 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. Pasting table from Excel 2013 to Word 2013 with VBA
    By simonlevey in forum Word Programming / VBA / Macros
    Replies: 3
    Last Post: 06-20-2016, 02:58 PM
  2. Replies: 1
    Last Post: 02-21-2016, 02:39 AM
  3. Replies: 5
    Last Post: 01-28-2016, 01:43 PM
  4. Excel 2013 and Access 2013 as Pivot Table External Data Source
    By Grimnebulin in forum Access Tables & Databases
    Replies: 1
    Last Post: 05-27-2015, 02:13 PM
  5. Replies: 0
    Last Post: 02-21-2013, 09:07 AM
  6. Replies: 0
    Last Post: 06-15-2011, 02:22 PM
  7. Extract SPECIFIC data from Excel and Paste it in a Word Table
    By smarinaj in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-04-2011, 03:15 PM

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