Results 1 to 3 of 3
  1. #1
    New Lounger
    Join Date
    Jan 2004
    Indianapolis, Indiana, USA
    Thanked 0 Times in 0 Posts

    Importing data from Word tables (Win XP)


    I'm writing to all of you Excel and Word power-users. I've got a special problem. I want to import text from cells in an MS Word table into corresponding cells in an Excel spreadsheet. Are their fields I can use to do this or can a macro be used to do this? I know very little about creating macros so, I'll need help.

    Thanks for reading this,

  2. #2
    Plutonium Lounger
    Join Date
    Nov 2001
    Thanked 7 Times in 7 Posts

    Re: Importing data from Word tables (Win XP)

    The easiest way to do this is to select the table in word, Edit > Copy, then move to Excel and Edit > Paste.

    You can automate this from VBA fairly easily, so long as you can identify the correct table in your word document and the destination cells in your Excel document.


  3. #3
    Silver Lounger
    Join Date
    Jan 2001
    West Long Branch, New Jersey, USA
    Thanked 9 Times in 7 Posts

    Re: Importing data from Word tables (Win XP)


    One problem you should be aware of is the following: if a table cell has a hard line return (hence creating 2 paragraphs within the cell), the copy-paste method suggested will make this into 2 cells (eg, if row1/col1 of the word table has a hard line return, it will paste into cells A1 and A2 of Excel). Moreover, if the next col in the Word table only has one para, then the Excel cell that receives this will be merged across 2 rows (in previous excample, row1/col2 of Word table, only having one para, will be pasted into a merger of B1 and B2). Can make things a bit messy.

    If you have this case, let us know. I think I wrote a macro some time ago that addresses the above as follows:
    - requires you to set up your Word table before the copy-paste so that you remove the hard line returns and replace them with some special sequence like xxx or something that does not appear in the table. This is a trivial application of replace in Word
    - the Excel macro looks for the special sequence and replaces it with the Excel ALT+Enter (this allows you to have hard line returns within a cell).

    If necessary, I think I can dig this up. Or you can do a search for this now that the search engine is working again.


Posting Permissions

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