I'm trying to paste a table into word from excel with VBA Excel.
I'm pasting it into a cell in a single column table of 4 rows I created in Word. So it is essentially a nested table.
I keep getting,
Run-time error 4605: Method 'PasteAsNestedTable' of object Selection failed
I'm trying to use PastAsNestedTable because otherwise I get the Run-time error about cells not matching as it is trying to merge the two tables.
So I get it is saying PasteAsNestedTable isn't a method of selection but how do I get around this issue?
My updated code goes:
Dim wdApp As Word.Application
Dim wdDoc as Word.Document
Dim tabl1 as Table, tabl2 as Table
Set wdApp = new Word.Application
With wdApp
.visible = True
.Activate
.Document.Add(location)
Set wdDoc=wdApp.ActiveDocument
With wdApp
Charts("chart1").ChartArea.Copy
.Selection.GoTo what:=-1,Name:="chart1"
.selection.Paste
(Then add some more charts)
End With
Sheets("Sheet1").Range("A1:F10").Copy
Set wdDoc=wdApp.ActiveDocument
wdDoc.Bookmarks("table").Range.PasteAsNestedTable
With wdApp
(Then repeat above pasting charts + tables)
`
If I made the Range a ListObjects could I somehow copy it in that way?
wdAppis a new Word Application with a totally empty document. There cannot be a Bookmark "tableplace". And.Selection.GoTo what:=-1 Name:="tableplace"lacks a comma between the parameters. So it will not compile. - Axel Richter.Selection.GoTo what:=-1 Name:="tableplace"format for copying charts to other bookmarks in the word doc and that works fine. - JoshD