Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / May 2008

Tip: Looking for answers? Try searching our database.

Extract data from Word Table

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Cliff - 11 May 2008 12:20 GMT
Hey all,

I have a large document with hundreds of word tables that I would like to
extract into Excel with VBA.  The MSDN example I found doesn't work so I'm
not sure how to proceed.

I don't know the Word Object model at all so any pointers or URLs would be
greatly appreciated.

Thanks,
Cliff
Doug Robbins - Word MVP - 11 May 2008 12:28 GMT
See the article "Control Word from Excel" at:

http://www.word.mvps.org/FAQs/InterDev/ControlWordFromXL.htm

Signature

Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

> Hey all,
>
[quoted text clipped - 7 lines]
> Thanks,
> Cliff
fumei - 11 May 2008 22:02 GMT
Perhaps if you gave a bit more detail on precisely what you want to do.

Also, perhaps give us reference to exactly what in MSDN you used, and found
did not work.  We can maybe give more detail pointers to what will work.

>Hey all,
>
[quoted text clipped - 7 lines]
>Thanks,
>Cliff
Cliff - 12 May 2008 02:23 GMT
---More detail per request---

I have a Word document with about 75 tables with varying column numbers and
numbers of rows.  Every table has the first row used for column headers.
Some tables span multiple pages.  Some cell data is just a URL and some
cells have multiple bulleted or numbered lines.  I wish to extract every row
in every column to an Excel file for further manipulation.  There's a total
of about 1500 rows in all of the 75 tables.

This example below from MSDN generates an out of bounds error and j is never
defined or incremented.
         
http://msdn.microsoft.com/en-us/library/aa537149(office.11).aspx#officeworda
utomatingtablesdata_extractingdatafromatable

TIA,
Cliff

On 5/11/08 5:02 PM, in article 8402484772789@uwe, "fumei via OfficeKB.com"
<u37563@uwe> wrote:

> Perhaps if you gave a bit more detail on precisely what you want to do.
>
[quoted text clipped - 12 lines]
>> Thanks,
>> Cliff
Doug Robbins - Word MVP - 12 May 2008 04:41 GMT
I would suggest that you show us the actual code that you tried to use.

How do you want the tables to be arranged in Excel?   One Word table to a
worksheet?  Or, all on one worksheet?

However, you don't need automation for this.  Just use Ctrl+A, then Ctrl+C
in Word, then move to Excel and single cell selected, use Ctrl+V

It there is text between the tables that you don't want in Excel, run a
macro containing the following code to get rid of it:

Dim apara as Paragraph
For Each apara in ActiveDocument.Paragraphs
   With apara.Range
       If .Information(wdWithinTable) = False Then
           .Delete
       End If
   End With
Next

Signature

Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

> ---More detail per request---
>
[quoted text clipped - 41 lines]
>>> Thanks,
>>> Cliff
Cliff - 13 May 2008 00:07 GMT
Thanks Doug, I'll give this a try.

Cliff

On 5/11/08 11:41 PM, in article empLGI#sIHA.2292@TK2MSFTNGP03.phx.gbl, "Doug
Robbins - Word MVP" <dkr@REMOVECAPSmvps.org> wrote:

> I would suggest that you show us the actual code that you tried to use.
>
[quoted text clipped - 15 lines]
>     End With
> Next
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.