embed an excel sheet object into a word 2007 document

R

RAMA

When I have embedded an excel sheet object into a word 2007 document, how can
I read the data in the excel sheet and how can I track changes done in the
sheet using VBA. Can some one help me on this.
Thanks,
Rama
 
J

Jean-Guy Marcil

RAMA said:
When I have embedded an excel sheet object into a word 2007 document, how can
I read the data in the excel sheet and how can I track changes done in the

In order to track changes in an Excel Workbook, it must be shared.
An embedded worksheet cannot be shared, so you cannot track changes.
sheet using VBA. Can some one help me on this.

As for readng the data, this can be done.
Here is some code to get you going (Assuming the Embedded Excel Object is an
inline shape):

Sub OpenEmbeddedExcel()

Dim Shp As Word.InlineShape
Dim objEXl As Object

With Selection.InlineShapes(1)
If .Type = wdInlineShapeEmbeddedOLEObject Then
If .OLEFormat.ProgID = "Excel.Sheet.8" Then
.OLEFormat.Activate
Set objEXl = .OLEFormat.Object
With objEXl.ActiveSheet
'For example:
.Cells(1, 1).Value = "Test"
'Etc.
End With
End If
End If
SendKeys "{ESC}"
End With

End Sub
 
R

RAMA

Thanks a lot Jean, I will try to use the code that you gave and will try to
extract the data from it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top