I wanted to copy a table in a word file to excel using excel vba. To do this, I ran the following code.
Dim write_row As Integer
Dim tableObject As Object
Dim tableItem As Variant
Dim WordApp As Object
Dim WordDoc As Word.Document
Set WordApp = CreateObject("Word.Application") ' CreateObject関数でWordをセット
WordApp.Visible = False
Set WordDoc = WordApp.Documents.Open("C:\Users\test.docx")
Set tableObject = WordDoc.Content.Tables
write_row = 1
For Each tableItem In tableObject
tableItem.Range.Copy
Cells(write_row, 1).PasteSpecial Paste:=xlPasteAll
write_row = write_row + 40
Next
Application.CutCopyMode = False
WordDoc.Close
WordApp.Quit
Then excel pasted the image data of only the first part of each table out of the three tables in the word file. I did not expect that the tables in the word file would be pasted as images into excel, but the purpose was to check the contents of the tables, and the operation was lightened, so there was no problem in that respect. However, I cannot overlook the fact that the image data contains only the first part of the table. How can I copy all the table contents in the word file to excel as image data?