Я пытаюсь создать чат в Excel и вставить его в слово документ в позиции закладки "1".
макрос умрет при 'Selection.GoTo What: = wdGoToBookmark, Name: = "1"'
Sub Macro1()
Dim objWord As Object
Set objWord = CreateObject("Word.Application")
'open the word file
objWord.Documents.Open "N:\Template\Template.docx"
objWord.Visible = True
'create and format the chart
ThisWorkbook.Activate
Range("A:A,C:C").Select
Range("C1").Activate
ActiveSheet.Shapes.AddChart2(227, xlLine).Select
ActiveChart.SetSourceData Source:=Range("Sheet1!$A:$A,Sheet1!$C:$C")
ActiveChart.Axes(xlCategory).Select
Selection.TickLabels.NumberFormat = "m/yyyy"
'copy the chart
ActiveChart.Parent.Copy
objWord.Activate
objWord.Visible = True
Set objSelection = objWord.Selection
'go to the bookmark in the word doc
Selection.GoTo What:=wdGoToBookmark, Name:="1"
'paste the chart
objWord.Selection.Paste
End Sub