Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: VBA Word
Hello,
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 3:02am
Kizo1539
Edited 8-Feb-11 3:04am
(no name)53.3K
v2
Comments
losmac at 8-Feb-11 11:19am
   
from http://www.word07.com/file-formats.htm
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 at 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 at 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
0 OriginalGriff 480
1 Maciej Los 304
2 Richard MacCutchan 225
3 BillWoodruff 169
4 Suraj Sahoo | Coding Passion 155
0 OriginalGriff 8,759
1 Sergey Alexandrovich Kryukov 7,407
2 DamithSL 5,639
3 Maciej Los 5,269
4 Manas Bhardwaj 4,986


Advertise | Privacy | Mobile
Web01 | 2.8.1411028.1 | Last Updated 8 Feb 2011
Copyright © CodeProject, 1999-2014
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