Hi Sandra.
How do i set the ActiveDocument?
Having looked at this further, I think this may not be the solution
you are looking for. I cannot find a way of extracting the Shape once
you've found it, other than to select it and then copy it to the
clipboard. There is very likely a way to extract it to a file, but I
can't find it. You may get a better answer in a Word or Office
newsgroup.
If you do want to proceed with this method, here is how you process
each of a set of documents:
First, set a reference to the Microsoft Word Object Library, and to
the Microsoft Office Object Library. You only need the Office library
because the msoPicture constant is in Office (I thought it was in
Word) but you can't redistribute Office libraries so the number of
references doesn't really matter.
Dim WordApp As Word.Application, _
WordDoc As Word.Document, _
MyShape As Word.Shape, _
CurrentFile As Long, _
NameArray() As String
' The code assumes that there is a set of file names in
' NameArray, above.
Private Sub Command1_Click()
Set WordApp = New Word.Application
For CurrentFile = LBound(NameArray) To UBound(NameArray)
Set WordDoc = WordApp.Documents.Open( _
NameArray(CurrentFile))
For Each MyShape In WordDoc.Shapes
If MyShape.Type = Office.msoPicture Then
MyShape.Select
WordApp.Selection.Copy
' Here, you would have to take the picture off the
' clipboard and get it into a Picture Box or a memory DC,
' or similar, so that it could be saved to a file. Answers
' to how you do that can be obtained at
' microsoft.public.vb.winapi.graphics.
End If
Next
WordDoc.Close wdDoNotSaveChanges
'WordDoc.Close wdSaveChanges
Next
Set WordDoc = Nothing
WordApp.Quit
Set WordApp = Nothing
End Sub