Sub CopyCaption()
Dim ilsh As Word.InlineShape
Dim fld As Word.Field
Dim xlApp As Excel.Application
Dim xlWbk As Excel.Workbook
Dim xlWks As Excel.Worksheet
Set ilsh = ActiveDocument.InlineShapes(1)
Set fld = ActiveDocument.Fields(2)
Set xlApp = CreateObject("Excel.Application")
xlApp.Visible = True
Set xlWbk = xlApp.Workbooks.Open(ilsh.LinkFormat.SourceFullName)
Set xlWks = xlWbk.ActiveSheet
xlWks.Cells(1, 1) = fld.Result
xlWbk.Save
End Sub
|