A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Word » Tables
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Macro for word tables to excel



 
 
Thread Tools Display Modes
  #1  
Old July 12th, 2006, 09:45 PM posted to microsoft.public.word.tables
[email protected]
external usenet poster
 
Posts: 1
Default Macro for word tables to excel

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

  #2  
Old July 12th, 2006, 11:21 PM posted to microsoft.public.word.tables
Jezebel
external usenet poster
 
Posts: 1,369
Default Macro for word tables to excel

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.


wrote in message
oups.com...
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



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
running an Excel macro from MS Access Rafi Using Forms 2 March 28th, 2006 06:19 PM
consolidation of tables in excel with text and figures samenvoegen van sheets Worksheet Functions 8 March 2nd, 2006 03:27 PM
TRYING TO SET UP EXCEL SPREADSHEET ON MY COMPUTER MEGTOM New Users 5 October 27th, 2005 03:06 AM
Macro Help In Excel welshlad General Discussion 14 October 26th, 2005 02:34 PM
Ctrl+A macro fix for problem in Excel 2003 David McRitchie General Discussion 4 June 19th, 2004 12:01 PM


All times are GMT +1. The time now is 12:10 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.