Sub CopyTables() Set appWord = CreateObject("Word.Application") On Error GoTo emergencyexit fileNames = Array("c:\1.doc","c:\2.doc") For Each Filename In fileNames Set docWord = Nothing Set docWord = appWord.Documents.Open(Filename) If Not docWord Is Nothing Then docWord.tables(docWord.tables.Count).Select appWord.Selection.Copy ActiveSheet.Paste docWord.Close ActiveSheet.UsedRange.Offset(ActiveSheet.UsedRange.Rows.Count).Resize(1, 1).Select End If Next emergencyexit: appWord.Quit End Sub
Thursday, February 4, 2010
Export last table from Word to Excel
This sample will copy last table from each of given word documents to active sheet.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment