Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 07-28-2011, 01:22 AM
Catalin.B Catalin.B is offline Inserting excel spreadsheet into word doc Windows Vista Inserting excel spreadsheet into word doc 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
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Embedded Excel Spreadsheet in Word Loses Ribbon amoncur Word 0 07-03-2010 09:22 PM
Word Fill-in form with Excel spreadsheet karik Word 0 01-11-2010 08:45 AM
Auditing on Excel and Spreadsheet documents paulmills Office 0 12-08-2009 01:13 PM
How do I use an Excel form to populate and Excel spreadsheet apostht Excel 0 05-21-2006 11:17 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 01:07 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft