I am trying to automatize filling in a third party form from an Excel Workbook VBA module. They sadly have gone with a Word document with an in-line Excel workbook embedded, which contains cells as named ranges that I want to edit.
How do I assign the InlineShapes object to an Excel.workbook object so that I can expose it to Excel methods and properties?
This is what I have tried so far:
Sub test()
Dim wdApp As Word.Application
Set wdApp = CreateObject("word.application")
wdApp.Visible = true ' for testing
Dim wdAppendixB As Word.Document
Set wdAppendixB = wdApp.Documents.Add(ThisWorkbook.Path & "\Templates\form_template.dotx")
Dim wbAppB As Excel.Workbook
wdAppendixB.InlineShapes.Item(1).OLEFormat.Edit
Set wbAppB = wdAppendixB.InlineShapes.Item(1).OLEFormat.Object
wbAppB.Sheets("Sheet1").Range("date1").Value = "2019-06-02"
Exit Sub
As soon as the script opens the OLE object for editing, the script stops with no errors. Closing the OLE object for editing does not resume the script.
If I omit editing the object and just set the workbook object to the OLEFormat.Object it errors out with Run-time error '430' "Class does not support Automation or does not support expected interface".
Any suggestion is appreciated.