Let's give this another shot...
Create another add-in (I will give an example of an XLAM) then or you could probably modify your COM add-in to this, or to ensure that this new add-in is running. This add in will trap the Application-level App_WorkbookActivate
event, and check the new workbook name to see if it likely comes from Microsoft Word.
If the workbook meets this criteria, since it is triggering the App_WorkbookActivate
event, then it seems reasonably safe to assume that the current ActiveDocument
in MS Word is the container.
Then, we just set some object variables to capture the Word.Application
and then just a matter of getting the ActiveDocument
, it's .Path
and it's .Name
, which we can store these values in Named variables within the Excel workbook.
You can view them in the Names
manager, or access them programmatically by reference to their name, .Names("docPath")
and .Names("docName")
.

Put this in a standard module in the XLAM file:
Sub Auto_Open()
Application.Run "ThisWorkbook.Workbook_Open" 'just in case
End Sub
The following code goes in the ThisWorkbook
module of the XLAM file:
Option Explicit
Private WithEvents App As Application
Dim dictWorkbooks As Object
Private Sub Workbook_Open()
'## Instantiate the public variables for this Add-in:
Set App = Application
Set dictWorkbooks = CreateObject("Scripting.Dictionary")
End Sub
Private Sub App_WorkbookActivate(ByVal Wb As Workbook)
'## Attempt to determine if a Workbook is opened from MS Word,
' and if so, store the container document's path & name in
' named variable/range in the Workbook.
Dim wdApp As Object
Dim wdDoc As Object
Dim docPath As String
Dim docName As String
Dim w As Integer
If Wb.Name Like "Chart in Microsoft Word" Then
'Get out of here if we already have this workbook activated.
If dictWorkbooks.Exists(Wb.Name) Then Exit Sub
Set wdApp = GetObject(, "Word.Application")
Set wdDoc = wdApp.ActiveDocument
docPath = wdDoc.Path
docName = wdDoc.Name
dictWorkbooks.Add Wb.Name, docName
With Wb
On Error Resume Next
.Names("docPath").Delete
.Names("docName").Delete
On Error GoTo 0
.Names.Add Name:="docPath", RefersToR1C1:=docPath
.Names("docPath").Comment = "A variable stores the parent DOC file's path"
.Names.Add Name:="docName", RefersToR1C1:=docName
.Names("docName").Comment = "A variable stores the parent DOC file's name"
End With
End If
End Sub
Private Sub App_WorkbookBeforeClose(ByVal Wb As Workbook, Cancel As Boolean)
'## If you open multiple charts from the word document, without closing the Workbook
' they will be assigned unique names. However, if you open & close multiple Workbook
' they will all have the same name "Chart in Microsoft Word". This method will
' remove an existing Key from our Dictionary when a workbook is closed, in order to
' prevent false matches.
If dictWorkbooks.Exists(Wb.Name) Then _
dictWorkbooks.Remove Wb.Name
End Sub