Sorry, the other macro has some errors, this works:
Private Sub CommandButton1_Click()
Dim workbook As InlineShape
For Each workbook In ActiveDocument.InlineShapes
Application.ScreenUpdating = False
With workbook
On Error Resume Next
If .Type = wdInlineShapeEmbeddedOLEObject Then
''# Excel.Sheet.12 for Excel 2007
If .OLEFormat.ClassType = "Excel.Sheet.12" Then
''# Open Object as spreadsheet
.OLEFormat.DoVerb wdOLEVerbPrimary
''# If you want, you can also do any updates here like
.OLEFormat.Object.ActiveSheet.Cells(2, 2).Value = ".1"
''# Nasty - but it works - SendKeys
SendKeys "{ESC}", True
.OLEFormat.Object.Close
End If
End If
End With
Next
Application.ScreenUpdating = True
End Sub
|