Click here to Skip to main content
13,045,790 members (46,050 online)
Rate this:
Please Sign up or sign in to vote.
See more:
As the title says, I need to embed a word .dotm template within a regular .doc/.docx file.

The reason I need to do this is because there is a somewhat larger number of templates that my company has, and they are all share code that is located in one global template.

The goal is to being able to send our clients only the .doc/.docx file, and the global .dotm template and avoid sending all of the (pretty large number of) .dotm templates.

The problem is that .doc/.docx files only store a reference to the template they're created with. (ex. A.docx stores a reference to B.docm, which in turn gets some code from OurGlobalTemplate.dotm).

My question is whether it is possible to embed the template VBA code from B.docm to A.docx (and avoid sending B.docm to our clients)?

Thanks, in advance, for any answers.
Posted 8-Feb-11 2:02am
Updated 8-Feb-11 2:04am
losmac 8-Feb-11 11:19am
Extension Use
.docx A standard Word document with no macros or code
.dotx A Word template with no macros or code
.docm A Word document that could contain macros or code
.dotm A Word template that could contain macros or code
Kizo1 9-Feb-11 8:52am
Thank you for your response, it has helped me to some extent.
Now I am aware of the .docm word document that can contain macros and code.

But another problem has arose. When you create a "New document" from .dotm template, and save it as a .docm document, it still doesn't copy the code from the template in it, it only ads reference.

As it is now, i can only open the .dotm template and save it as a .docm document, which is rather unpleasant to work with, since after that it is not a template, and it has to be used as one (copying and pasting). :)

I now have to investigate if there is a possibility (an option) for saving the code embedded in the document. (if anyone has the answer to this, please don't hesitate to answer :) )

Thanks again.
losmac 24-May-11 14:50pm
Can you send MS Word AddIn to your clients with "OurGlobalTemplate.htm" code?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170713.1 | Last Updated 8 Feb 2011
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100