Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

converting word tables to excel

2 views
Skip to first unread message

Eckard Buchner

unread,
Jan 28, 2004, 2:15:49 AM1/28/04
to
I have a document that describes a new piece of software. The cost for each
feature is described in a word table. I would like to extract these tables
(with a makro?) into an excel sheet automatically. Any ideas anybody?

Eckard


Debra Dalgleish

unread,
Jan 28, 2004, 5:35:07 PM1/28/04
to
If this is a one-time task, you can open the Word document, copy the
table, and paste it into Excel.

--
Debra Dalgleish
Excel FAQ, Tips & Book List
http://www.contextures.com/tiptech.html

Eckard Buchner

unread,
Jan 29, 2004, 1:32:48 AM1/29/04
to
No, it's not a one time task. The specifiaction document is reviewed several
times. This leads to changes in the cost estimates. So I would have to paste
a dozen or so tables into excel againa and again.

My idea was to open a word document from excel (how?), extract the table
objects from the document structure (again, how?) and then populate an excel
sheet with the columns and rows of these tables. I'm not a makro expert. If
someone could give me a hint...

Thanks
Eckard


"Debra Dalgleish" <d...@contexturesXSPAM.com> schrieb im Newsbeitrag
news:4018391B...@contexturesXSPAM.com...

Dave Peterson

unread,
Jan 29, 2004, 7:10:49 PM1/29/04
to
If you don't get a workable answer, you may want to post the question in a Word
newsgroup.

In fact, to me, this looks like a reasonable candidate for
cross-posting--including both an excel newsgroup and a word newsgroup in the
headers and sending once.

--

Dave Peterson
ec3...@msn.com

Eckard Buchner

unread,
Feb 3, 2004, 2:35:50 AM2/3/04
to
Thank you Dave, good idea. I got help in a word newsgroup. Here is the
current version of my macro (raw as it is).
Maybe, Debra, you have a look and add this to your great excel pages?

Thanks
Eckard

' ------------------------------
Sub ImportDoc()
Dim wdApp As Word.Application
Dim wdDoc As Word.Document
Dim wdTable As Word.Table
Dim wdRow As Word.Row
Dim wdCell As Word.Cell
Dim nRow, nCol, nTab
Dim bHeader As Boolean

Set wdApp = New Word.Application
Set wdDoc =
wdApp.Documents.Open(FileName:="K:\Projekte\SironWeb\TDI-Integration\SironWe
b Integration TDI.doc")
wdApp.Visible = True
'Call or insert your table copying code here

Range("A1:E999").Clear

nTab = 1
nRow = 1

For Each wdTable In wdDoc.tables

nTab = nTab + 1
bHeader = True

For Each wdRow In wdTable.rows
nCol = 1
nRow = nRow + 1
For Each wdCell In wdRow.cells
nCol = nCol + 1


With ActiveSheet.cells(nRow, nCol)
.Select
.Font.Bold = bHeader
If bHeader Then
.HorizontalAlignment = xlCenter
Else
.HorizontalAlignment = xlHAlignGeneral
End If
End With

wdCell.Range.Copy
ActiveSheet.Paste

Next
bHeader = False
Next
nRow = nRow + 1
Next


'wdApp.ActiveDocument.Save
'wdApp.ActiveDocument.Close
wdApp.Quit
Set wdDoc = Nothing
Set wdApp = Nothing
End Sub

Dave Peterson

unread,
Feb 3, 2004, 6:53:31 PM2/3/04
to
Even if Deb doesn't add this to her pages, it's now on google.

So lots of people can find it.

Eckard Buchner wrote:
>
> Thank you Dave, good idea. I got help in a word newsgroup. Here is the
> current version of my macro (raw as it is).
> Maybe, Debra, you have a look and add this to your great excel pages?
>
> Thanks
> Eckard
>

<<snipped>>
--

Dave Peterson
ec3...@msn.com

0 new messages