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?
G'day andy26 <andy26@discussions.microsoft.com>,
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:
>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?
andy26 - 13 Sep 2005 16:02 GMT
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
> G'day andy26 <andy26@discussions.microsoft.com>,
>
[quoted text clipped - 15 lines]
> >object as there may be some that are not.
> >Can anyone help?
Word Heretic - 14 Sep 2005 03:03 GMT
G'day andy26 <andy26@discussions.microsoft.com>,
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:
>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
[quoted text clipped - 36 lines]
>> >object as there may be some that are not.
>> >Can anyone help?