a) Open any excel worksheet.
b) Select few cells.
c) Copy them in
clipboard.
d) while pasting in word document, select the paste
special... from Edit
menu bar.
e) A dialog box will appear with
several options.
f) select paste as. picture ( Enhanced Metafile ).
We repeated the above procedure on a machine having MS Word 2003
installed. The object (Enhanced Metafile) is detected by MS Word as an
InlineShape object in VBA of type Picture (wdInlineShapePicture).
We then activated this object using the .Activate Method.
Activation of the object automatically converted this InlineShape object to
Shape Object of type Canvas (msoCanvas).
Once this is achieved, We can easily retrive the text from the canvas
object.
Thats what it took in Word 2003.
The sample code is attached with this mail.
Hope that helps!!
Regards,
Neeraj Shinde
************************************************************************************
SAMPLE VBA CODE
************************************************************************************
Sub ReadMetaFilePicture()
Dim
ish As InlineShape
Dim iShape As
Shape
''MsgBox
ActiveDocument.InlineShapes.Count
''MsgBox
ActiveDocument.Shapes.Count
For Each ish In
ActiveDocument.InlineShapes
If
ish.Type = wdInlineShapePicture
Then
ish.Activate
''INLINESHAPE GETS CONVERTED TO
SHAPE
''This will open the shape in a new document
.....
''and will become the "ActiveDocument" i.e. a new
instance
With
ActiveDocument.Shapes(1)
If .Type = MsoShapeType.c
Then
MsgBox "Canvas Items within : " &
.CanvasItems.Count
For Each iShape In
.CanvasItems
If iShape.Type = MsoShapeType.msoAutoShape And iShape.TextFrame.HasText
Then
MsgBox
iShape.TextFrame.ContainingRange.Text
End
If
Next
End
If
ActiveDocument.Close
''Will close the Picture (Shape) from edit
mode
End
With
End If
Next
End Sub