Can I put the macro on the template

M

mardukes

I'm using Dynamics CRM which requires Word XML as the template. That may not
matter because I want to know if the macro can be carried on a template. I
can record macros but they seem to store on the local machine and I don't
want to have to record it or even copy it to every user. Can one be sent out
on the template?

thanks
 
M

mardukes

I am filled with joy that the articles says, "Macros that are associated with
a particular document type, and perhaps have to run automatically when
documents of that type are opened or created."

Problem is that it says copy the macro to the template. That's what I can't
figure out how to do.

Also note that the template resides in CRM not on the user machine. It is
delivered to Word on demand.
 
L

Lene Fredborg

The following article may help you:
http://www.gmayor.com/installing_macro.htm

I have no experience with Dynamics CRM. I can only tell you how it normally
works:

When you record a macro, you can select where to store it. In the Record
Macro dialog box, note the “Store macro in†field. The field lets you select
form the following locations:

- if the active document is a template, you can store the macro in that
template or in Normal.dot (Normal.dotm in case of Word 2007)

- if the active document is a normal document, you can store the macro in
the document itself, in the template to which the document is attached or in
Normal.dot (Normal.dotm in case of Word 2007)

Thus, to be able to store a recorded macro directly in a specific template,
it must either be the active document or, alternatively, a document attached
to the template must be the active document.

You can also copy existing macros (or rather macro modules that may hold
several macros) from one template/document to another via the Organizer.
Finally, you can copy macros and macro modules between open documents and
templates via the VBA editor. The VBA editor also lets you export and import
macro modules.

--
Regards
Lene Fredborg - Microsoft MVP (Word)
DocTools - Denmark
www.thedoctools.com
Document automation - add-ins, macros and templates for Microsoft Word
 
P

Peter Jamieson

Since I don't know what the requirement at the Dynamics CRM end are, I'm
not sure the following will help, but...

1. There are two sorts of Word XML format:
a. single-file .xml, which contains WordProcessingML. There are two
main varieties of this: Word 2003 and Word 2007. The Word 2003 sort can
contain macros. The Word 2007 sort cannot (as far as I know).
b. .docx/.docm (and .dotx/.dotm). These are ZIP files with chunks of
XML and various pieces of structural information. .docm/.dotm files can
contain macros.

The Word .xml file is not a template in the strict Word sense of the
word (i.e. the basis for a tear-ff copy of a document), nor is the
..docm. If your document has to be a template, it will have to be a .docm

If the "template" in Dynamics has to be a proper .xml file, it can't be
a .docx/.docm because they are not actually XML

In both .xml and .docm/.dotm, the macro code is saved in a binary or
encoded format (i.e. you cannot actually read the code). In the case of
the Word 2003 xml file, the encoded macros are contained in one or more
ordinary elements of the xml. So it's still a proper XML file. In the
..docm/.docx, the code is contained in a .bin file within the zip file.
So even if Dynamics can manage a .zip file, it may not like the .bin.

Someone was asking about this last year and commented that

"CRM will not allow me to upload a word doc with macro"

If that's true I guess it doesn't matter which format you save as.

Peter Jamieson

http://tips.pjmsn.me.uk
 
L

Lene Fredborg

Sorry, I missed the "XML" in your first post. My answer may be irrelevant...

--
Regards
Lene Fredborg - Microsoft MVP (Word)
DocTools - Denmark
www.thedoctools.com
Document automation - add-ins, macros and templates for Microsoft Word
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top