Group:  Microsoft Word ยป microsoft.public.word.tables
Thread: Macro for word tables to excel

DotNetBag
.NET Development Newsgroups

HTVi
TV Discussion Newsgroups

Our Hot Pick: Rising Antivirus 2006 - Certified by TUV & Checkmark! Get 10% discount by entering this coupon code: ONDISCOUNT10
Rising Antivirus 2006

Macro for word tables to excel
akh2103[ at ]gmail.com 12.07.2006 20:45:44
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

Re: Macro for word tables to excel
"Jezebel" <warcrimes[ at ]whitehouse.gov> 12.07.2006 22:21:33
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.


<akh2103[ at ]gmail.com> wrote in message
news:1152737144.068844.218820[ at ]h48g2000cwc.googlegroups.com...
[Quoted Text]
> 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
>


Home | Search | Terms | Imprint | Contact
Newsgroups Reader - provided by WiredBox.Net