Problem with Word Templates Collection

T

tartancli

Hi,

I have a problem using the Word Templates collection to determine the
current active templates. I have a COM Addin, which checks the Templates
collection to determine what templates are available (attached,global etc)
for the Word application. It works fine when i add a new template through the
Tools menu. Usually it works fine for attached templates - but i have one
"template" which isn't listed in the Templates collection.

The manner in which the "template" was generated would make me doubtful that
it is a genuine template, but in some respects Word seems to treat it as a
template.

Word seems to treat it as template because if i double click on it, Word
opens a new document (Document1 for example), and if i open up the VBA
Editor, i see that a code module present in the "template" is available to
this new document.

As i said the "template" was generated in a dodgy manner as follows: A new
document was created, a macro was added. the doc was saved and closed. The
file extension was then changed from .doc to .dot.

So, Word seems to think this is a template is some respects but not in
others. Is there some way that i can detect this type of document/template in
my Add-in.

Thanks.
 
P

pavan

Hi,
No! You will not be able to get the name of the template if it is
renamed from doc to dot. I'm not sure how Word UI reacts to it but
automation can't give u the name, to my knowledge.

Hope this helps,
Regards,
Pavan
PS: If you happen to find any workaround for this, pls share with us.
 
T

tartancli

Hi Pavan,

Thanks for that. I have not found any workaround. I checked the "attached
template" of the new document created by double clicking the "template" and
it says normal.dot. It seems that it is a Word bug.

Thanks again!
 

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