Converting embedded Word Objects

A

andy26

I have a Word doc that contains a number of inline word doc objects. I am
trying to scan through the doc and replace each of these OLEs with its actual
contents. I can do this manually for one object but I can't figure out how
to do this programmatically. I also need to check the object is a word doc
object as there may be some that are not.
Can anyone help?
 
W

Word Heretic

G'day andy26 <[email protected]>,

You activeate it, which opens a new doc window, which you copy from,
and then paste back into the original. Each Shape has properties you
can use to determine if it is a word document (class id)

Steve Hudson - Word Heretic

steve from wordheretic.com (Email replies require payment)
Without prejudice


andy26 reckoned:
 
A

andy26

Thanks for the advice. I'm a bit of a newbie at VBA. I've got something
working now, but I would be grateful if you could see if this code makes
sense:

Sub Replace_word_OLEs()
Dim iShape As Word.InlineShape
For Each iShape In ActiveDocument.InlineShapes
If Not iShape.OLEFormat Is Nothing Then
If iShape.OLEFormat.ClassType Like "Word.*" Then
iShape.Activate
ActiveDocument.Range.Select
Selection.Copy
ActiveDocument.Close
iShape.Delete
Selection.PasteAndFormat (wdPasteDefault)
End If
End If
Next iShape

End Sub
 
W

Word Heretic

G'day andy26 <[email protected]>,

Looks good. You may have to select the ishape before deleting to make
sure the selection is now in the right place.

Steve Hudson - Word Heretic

steve from wordheretic.com (Email replies require payment)
Without prejudice


andy26 reckoned:
 

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