Reference issue

F

Fred Kruger

I know this may sound strange but can anyone tell me if it is posible to
refernce the normal.dot at runtime to a global template.

I work for a company that has thousands of users of word in varying versions
we want to be able to amend the normal.dot with certain information and also
put some sub procedures into it and save without deleting and reinstalling.

ie to do this i would normally open the normal.dot and have to manually add
the items and refernce to the template and type the sub procedures into it
anfd then save it. Can I do this through code? or do I have to manually do it
to every one?

If it is possible please can you tell me how.

Fred
 
J

Jean-Guy Marcil

Fred Kruger was telling us:
Fred Kruger nous racontait que :
I know this may sound strange but can anyone tell me if it is posible
to refernce the normal.dot at runtime to a global template.

I work for a company that has thousands of users of word in varying
versions we want to be able to amend the normal.dot with certain
information and also put some sub procedures into it and save without
deleting and reinstalling.

ie to do this i would normally open the normal.dot and have to
manually add the items and refernce to the template and type the sub
procedures into it anfd then save it. Can I do this through code? or
do I have to manually do it to every one?

If it is possible please can you tell me how.

I would not recommend this set up.

It is by far much easier to just deploy a global template.

If you must.. this code, for example, will open the Normal.dot file:

Documents.Open NormalTemplate.FullName

This means you can assign a document object to the normal.dot template if
you have too...

But why can't you use a global template instead?

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 
F

Fred Kruger

Jean-Guy

Thanks for this I am aware of the global template against Normal.dot,
however the company I work for requires that all new documents created on
their machines ahve to have restriction markings dependent on the
classification of the content of the document. Therefore ideally it would be
best to set the normal.dot with all the necessary details etc and subsequent
coding in the document open and document new in the document object of the
normal.dot.

This could be done by a complete over write of all normal.dots on all
machine however this would create problems with personal macros of people who
have stored them in the normal.dot.

Hence the request to know if it is possible using vb code to open the
normal.dot set a refernce to globally mounted template men and then insert
code into the sub routines of the document object Private Sub Document_New()
and Private Sub Document_open().

If this is posible then it would save the issue of trying to educate users
on saving their macros to a template and setting it as a add in.... If this
makes sense.

The code you gave opened the normal template but is it pos to reference and
setup the sub procedures without physically typing it in?

Thanks in anticipation.

Fred
 
J

Jean-Guy Marcil

Fred Kruger was telling us:
Fred Kruger nous racontait que :
Jean-Guy

Thanks for this I am aware of the global template against Normal.dot,
however the company I work for requires that all new documents
created on their machines ahve to have restriction markings dependent
on the classification of the content of the document. Therefore
ideally it would be best to set the normal.dot with all the necessary
details etc and subsequent coding in the document open and document
new in the document object of the normal.dot.

This could be done by a complete over write of all normal.dots on all
machine however this would create problems with personal macros of
people who have stored them in the normal.dot.

Hence the request to know if it is possible using vb code to open the
normal.dot set a refernce to globally mounted template men and then
insert code into the sub routines of the document object Private Sub
Document_New() and Private Sub Document_open().

If this is posible then it would save the issue of trying to educate
users on saving their macros to a template and setting it as a add
in.... If this makes sense.

The code you gave opened the normal template but is it pos to
reference and setup the sub procedures without physically typing it
in?

Keep in mind that users playing around with their Normal.dot might interfere
with the code you plan to inject into it. Also, if Normal.dot crashes.. your
code will be gone. Finally, any document created based on ate template other
that Normal.dot will not be intercepted by your Document_New() and
Document_Open() subs.

This is why it is better to have a global add-in with document events that
can get fired whenever a document is created/opened.
See:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnword2k2/html/odc_wdappevnt.asp
It was written for Word 2002, but still applies to Word 2003 (It is just
that Word 2003 has a few more events, especially those targeted fro handling
XML).

But if you still insist on going the Normal.dot road, combine the code I
gave you before to get a handle on the Normal.dot template, then see the
online help on the following for examples of what to do next:
ActiveDocument.VBProject.VBComponents


--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 

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