This will work for both IPT and IAM.
The ErrorResumeNext is used to trap the error if there's no linked excel
sheet.
Cheers,
Teun
Sub GetLinkedExcelFileLocation()
Dim oDoc As Document
Dim oParameters As Parameters
Dim oTable As ParameterTable
On Error Resume Next
Set oDoc = ThisApplication.ActiveDocument
Set oParameters = oDoc.ComponentDefinition.Parameters
Set oTable = oParameters.ParameterTables.Item(1)
If Err Then
MsgBox "No linked Excel Sheet"
Err.Clear
Else
MsgBox oTable.FileName
End If
On Error GoTo 0
Set oDoc = Nothing
Set oParameters = Nothing
Set oTable = Nothing
End Sub