title: Can you get image data from an OLE object in Word using VBA?
body: <p>I'm using a script (that I didn't write) to convert Word docs to XML. Everything works perfectly as long as the Word doc is consistently styled. One of the things that the script can't handle is when images are inserted as OLE objects. These images are simply ignored by the script, whereas images that were inserted regularly, as non-OLE objects, are picked up by the script just fine.</p>
  
  <p>I've also been using a VBA script (see part of it below) to clean up the document prior to transforming it. The script adds styles to the document, moves some things, and...what I'm trying to make it do is convert OLE images to non-OLE images. </p>
  
  <p>So what I want to know is: is there a way to iterate through the inlineShapes in the document and convert OLE graphics to regular graphics or, is there a way to get the image data out of the OLE object and paste it into the document as a PNG.</p>
  
  <p>This is what <em>my</em> vba script does right now:</p>
  
  <pre><code>Sub docscrubber()
  
  Dim i  As Integer
  Dim total  As Integer
  Dim oIshp As InlineShape
  
  total = ActiveDocument.InlineShapes.Count
  i = 0
  For Each oIshp In ActiveDocument.InlineShapes
      i = i + 1
      On Error Resume Next
      Application.StatusBar = "Progress: " &amp; i &amp; " of " &amp; total
          With oIshp
  
           oIshp.Range.Copy
           oIshp.Select
           Selection.Paste
  
          End With
  Next oIshp
  
  End Sub
  </code></pre>
  
  <p>Instead of getting the image data, I get the document code. </p>
  
  <p>Thanks in advance!</p>