Using an embedded Word document to create a new instance of that document.
Posted
by jim
on Stack Overflow
See other posts from Stack Overflow
or by jim
Published on 2010-03-15T17:04:17Z
Indexed on
2010/03/15
17:09 UTC
Read the original article
Hit count: 267
For a variety of reasons that are immutable ... I have a Word document which contains a VBA application (the 'app document') which creates a new document based on another document (the 'template') which contains the framework for the new document. I want to embed the 'template' into the 'app document' so that I deliver one file and I know I am using the correct version of the 'template'.
I have, so far, embedded the 'template' file into the 'app document' and can find it by looping through "ThisDocument.InlineShapes", looking at .Field.OleFormat.IconLabel to find the 'template' by its name. The inlineShape.Field.OleFormat.Object is the 'template' document itself, and I can .Activate it, which causes it to appear as a regular document. I try to do SaveAs, and it does in fact save the file as the name I give it, however, that saved-as file is not left open, just the embedded file. I can not .Activate the file and just save it, then open the saved file, but that seems more work than necessary.
So ... is the way I am doing this "the way", or I have missed some obvious practice? TIA
© Stack Overflow or respective owner