Macro for word tables to excel

A

akh2103

There are lots of posts asking how to write a macro exporting a word
table to excel 2003. This is probably the most simple macro for this
task:

Sub GetWordTable()

Dim wdap As Word.Application
Dim wddc As Word.Document
Dim wdtbl As Word.Table

Set wdap = GetObject(, "word.application")
Set wddc = wdap.ActiveDocument
Set wdtbl = wddc.Tables(1)

wdtbl.Range.Cut

ActiveSheet.Paste

End Sub
 
J

Jezebel

Simple to the point of silly. How can you, at the Excel end, know that it's
the first table in the active document that you want? And why remove it
remove the document rather than copying it? You'll also get poor results if
any of the Word cells contains multiple paragraphs.

It's also poor programming to mixing early and late binding.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top