View Single Post
 
Old 07-28-2011, 01:22 AM
Catalin.B Catalin.B is offline Windows Vista Office 2007
Expert
 
Join Date: May 2011
Location: Iaşi, Romānia
Posts: 386
Catalin.B is on a distinguished road
Default

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
Reply With Quote