I'm trying to generate an excel file with 5 column from specific tables' cells in a word file (copy from word table to excel). My word file has 280 tables. I have no problem on addressing the cells that i want to copy from my word file. but i don't know why the result is an blank excel file. Maybe I'm wrong in the paste method uh i don't know... . This is my code:
Sub copyfromwordtoexcel()
Dim exApp As Excel.Application
Dim exDoc As Excel.Workbook
Set exApp = CreateObject("Excel.Application")
Set exDoc = exApp.Workbooks.Add
For xx = 1 To ActiveDocument.Tables.Count
On Error Resume Next
ActiveDocument.Tables(xx).Cell(2, 2).Range.Copy
exApp.Visible = True
Cells(xx, 1).Select
ActiveSheet.Paste
Application.Visible = True
exApp.Visible = False
ActiveDocument.Tables(xx).Cell(3, 2).Range.Copy
exApp.Visible = True
Cells(xx, 2).Select
ActiveSheet.Paste
i = ActiveDocument.Tables(xx).Rows.Count
ActiveDocument.Tables(xx).Cell(i - 2, 2).Range.Copy
exApp.Visible = True
Cells(xx, 3).Select
ActiveSheet.Paste
Application.Visible = True
ActiveDocument.Tables(xx).Cell(i - 1, 2).Range.Copy
exApp.Visible = True
Cells(xx, 4).Select
ActiveSheet.Paste
Application.Visible = True
ActiveDocument.Tables(xx).Cell(i, 2).Range.Copy
exApp.Visible = True
Cells(xx, 5).Select
ActiveSheet.Paste
Application.Visible = True
exApp.Visible = True
Next
End Sub
Thanks for your help