template info

F

Fred Kruger

can anyone tell me how to capture the name of the
template a document is created from please.

for example i created a template called test.dot and
start from file new the new document created from it is
called document1 but if you open the VBA editor there is
test.dot underneath the new document.

I haveover 900 templates that I manage and some need to
show a warning which is the same rather than going into
each one and put the warning in i want to add it to a add
i have that each template accesses on open.

There i will run a loop to check to see if the docment
being produced is one of these specific templates.

Can anyone help please

Thanks in anticipation.

Fred
 
J

JGM

Hi Freddie,

Have you looked at the "AttachedTemplate" property?

E.g.:

'_______________________________________
Dim myTemplate As Template

Set myTemplate = ActiveDocument.AttachedTemplate
MsgBox myTemplate.FullName
'_______________________________________

This will return the name and full path of the active document's attached
template, i.e. the template it was created from.
If you need only the name, replace

myTemplate.FullName

by

myTemplate.Name

HTH
Cheers!
 
F

Fred Kruger

Thanks for this

Fred
-----Original Message-----
Hi Freddie,

Have you looked at the "AttachedTemplate" property?

E.g.:

'_______________________________________
Dim myTemplate As Template

Set myTemplate = ActiveDocument.AttachedTemplate
MsgBox myTemplate.FullName
'_______________________________________

This will return the name and full path of the active document's attached
template, i.e. the template it was created from.
If you need only the name, replace

myTemplate.FullName

by

myTemplate.Name

HTH
Cheers!
--
_______________________________________
Jean-Guy Marcil
(e-mail address removed)

"Fred Kruger" <[email protected]> a écrit dans le message
de news: [email protected]...


.
 
C

Chip Orange

Does anyone know if it's possible to change the associated template by
setting the fullname property to another template name? If so, is there a
file picker function that would make this easy to do?

thanks.

Chip
 
C

Charles Kenyon

You don't change the name property, you change the template setting.

ActiveDocument.AttachedTemplate = "h:\Collection\Initial letter to
debtor.dot"

You could use the FileOpen dialog for this. See the article(s) on the MVP
vba FAQ about using built-in dialogs.


--

Charles Kenyon

See also the MVP FAQ: <URL: http://www.mvps.org/word/> which is awesome!
--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.
 

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