I have set of word 97-2003 documents with embedded files. I'm using the following code to extract them and save them to a folder. This code works for embedded word documents but when it get to a pdf document it has an error that says:

"An unhandled exception of type 'System.MissingMemberException' occurred in Microsoft.VisualBasic.dll

Additional information: Public member 'SaveAs' on type 'IAcroAXDoc' not found."

Can anyone tell me how to fix this?


With doc
Dim objEmbeddedShape As Word.InlineShape
Dim strShapeType As String
Dim objEmbeddedDoc As Object
For Each objEmbeddedShape In .InlineShapes
'Find and open the embedded doc.
strShapeType = objEmbeddedShape.OLEFormat.ClassType
objEmbeddedShape.OLEFormat.Open()
'Initialization
objEmbeddedDoc = objEmbeddedShape.OLEFormat.Object
Extract(objEmbeddedDoc)
'Save embedded files with names as same as those of icon label
Dim objEmbedFileName As String = System.IO.Path.Combine(FolderPath, objEmbeddedShape.OLEFormat.IconLabel)
If objEmbedFileName.Contains("pdf") Then
objEmbeddedDoc.SaveAs(objEmbedFileName)
End If
objEmbeddedDoc.SaveAs(objEmbedFileName) <------------------------- This is where it hits the error
objEmbeddedDoc.Close
'Reset objEmbeddedDoc for next object
objEmbeddedDoc = Nothing
Next objEmbeddedShape
End With