get the template name of a word document

H

henry

Hello,
I have tried to get the template name using Document.get_AttachedTemplate()
but i keep on getting normal.dot for all the documents that i have tried to
open which i am sure is not the name because when you open these documents
using microsoft word application and check the name of the attached template
(Tools - Templates and Add-Ins), it gives you the original name of these
documents. I will like to know if and how to get the original template name
of a document programmatically.

Thanks for your time nad assistance
 
K

krazymike

This gives the full path to the template.

Download the DSO OLE Document Properties Reader here:
http://support.microsoft.com/kb/224351

Be sure to add the DSOfile.dll to your references.

Dim oDocumentProps As DSOFile.OleDocumentProperties
Set m_oDocumentProps = New DSOFile.OleDocumentProperties
m_oDocumentProps.Open strFilePath, fOpenReadOnly,
dsoOptionOpenReadOnlyIfNoWriteAccess
Dim oSummProps As DSOFile.SummaryProperties
Set oSummProps = m_oDocumentProps.SummaryProperties
MsgBox oSummProps.Template
 
H

henry

Thanks Krazymike, your information proved useful

krazymike said:
This gives the full path to the template.

Download the DSO OLE Document Properties Reader here:
http://support.microsoft.com/kb/224351

Be sure to add the DSOfile.dll to your references.

Dim oDocumentProps As DSOFile.OleDocumentProperties
Set m_oDocumentProps = New DSOFile.OleDocumentProperties
m_oDocumentProps.Open strFilePath, fOpenReadOnly,
dsoOptionOpenReadOnlyIfNoWriteAccess
Dim oSummProps As DSOFile.SummaryProperties
Set oSummProps = m_oDocumentProps.SummaryProperties
MsgBox oSummProps.Template
 

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