+ Reply to Thread
Results 1 to 6 of 6

Macro to Export Word Tables to Excel

  1. #1
    Registered User
    Join Date
    05-17-2013
    Location
    South Carolina
    MS-Off Ver
    Excel 2010
    Posts
    16

    Macro to Export Word Tables to Excel

    I have a Word document that has several tables which I would like to pull into Excel (each table on a separate sheet). I have been copying/pasting the tables, but was wondering if there is a macro that can pull them in for me.

    I found the following macro online, but when I add it as a module in Excel, I get a run-time error at the
    Please Login or Register  to view this content.
    line.

    Does anyone know why?

    I am using Office 2010, and am on a MAC. I tried this on a PC as well and still got an error.

    Please Login or Register  to view this content.

  2. #2
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: Macro to Export Word Tables to Excel

    your code works on my excel 2010 win 8, but only with doc file, not docx
    Last edited by patel45; 05-18-2013 at 08:37 AM.
    If solved remember to mark Thread as solved

  3. #3
    Registered User
    Join Date
    05-17-2013
    Location
    South Carolina
    MS-Off Ver
    Excel 2010
    Posts
    16

    Re: Macro to Export Word Tables to Excel

    Yes, the file I want to import is a .doc file.
    I found a forum that said sometimes you have to replace the quotes as they don't come across correctly when copied. That didn't fix it, but it did highlight that the underscore in this line was "invalid character."

    Please Login or Register  to view this content.
    I tried deleting the underscore and also tried adding a file name
    Please Login or Register  to view this content.
    but in both cases I get a "type mismatch" error on the following line:
    Please Login or Register  to view this content.
    I know it's something I'm not doing correctly, but I'm not sure what it is. . .

  4. #4
    Registered User
    Join Date
    11-09-2009
    Location
    london, england
    MS-Off Ver
    Excel 2010
    Posts
    52

    Re: Macro to Export Word Tables to Excel

    Hi WesternGal

    I too gave your original code a go using Excel 2010 on Windows 7 and it worked for both doc and docx files. I was unable to replicate the error.
    However, I had a quick look online and found this useful msdn resource that describes "Programmatically Selecting Files in Excel for Windows and Excel for the Mac" http://msdn.microsoft.com/en-us/libr...FileNameMethod

    Hope the msdn link is of some help to you.
    Please click * if the answer was helpful.

  5. #5
    Registered User
    Join Date
    05-17-2013
    Location
    South Carolina
    MS-Off Ver
    Excel 2010
    Posts
    16

    Re: Macro to Export Word Tables to Excel

    Found an answer: on a MAC, the line has to read:
    Please Login or Register  to view this content.
    There were multiple other errors in the code I had copied, but I found the correct text to loop through all tables in Word and import them to excel on this thread:
    HTML Code: 
    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    11-23-2014
    Location
    Switzerland
    MS-Off Ver
    Word, Excel, Outlook, Power Point - all 2010
    Posts
    1

    Re: Macro to Export Word Tables to Excel

    Thanks a million, Western Gal. I had searched for days and worked sooo many hours to try to solve this problem. With your code plus a couple of tiny twiddles to it to import data from just one single-line table, it ran perfectly on my Windows PC.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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