PDA

View Full Version : Extract Embedded Objects



MWE
10-02-2009, 10:39 AM
I have a Word2003 file (document) with several embedded objects. Each object is a file originally embedded manually using the Insert Object approach. I wish to "extract" a copy of each object/file from the base document and place in the same directory as the base document.

I have pretty decent VBA skills in Word but have never used the inlineshape object (I think that is the approach to use). I have poked around in the Object Browser but have not found much that suggests a way to extract the file from the "package".

Any help would be appreciated.

Thanks.

fumei
10-02-2009, 02:22 PM
ActiveDocument.InlineShapes(1).OLEFormat.DoVerb VerbIndex:=1
will take the object InlineShape(1) - in my test an embedded doc file as an icon - and extracts that content into a new document window.

If the object is set for "Link to file", then DoVerb opens that file, not create a new document with the contents.

Does this help?

MWE
10-02-2009, 04:45 PM
ActiveDocument.InlineShapes(1).OLEFormat.DoVerb VerbIndex:=1
will take the object InlineShape(1) - in my test an embedded doc file as an icon - and extracts that content into a new document window.

If the object is set for "Link to file", then DoVerb opens that file, not create a new document with the contents.

Does this help?Thanks for the reply. Actually, I had gotten as far as experimenting with the various doverb options. The one you suggest opens the package for (manual) editing in the Object Packager window. I am not sure that that particular action gets me anything. How do I save the file preferrably with its original name, e.g., FileName.msg?

fumei
10-05-2009, 09:33 AM
You can not. As stated, "If the object is set for "Link to file", then DoVerb opens that file."

My bolding, to emphasize.

Thus, IF it is "Link to file", you can use VBA DoVerb to open it, then VBA Save to save the file to the Path value of the document.

That is the best you can do. This will not help you with a .msg file though. DoVerb just opens the .msg file.