name of dot file

K

Keith G Hicks

I use vba word automation in Access quite a bit. I've come across a
situation where it would be helpful for me to be able to determine the name
of the dot file that was used to create a document but I don't know if it's
possible. Here's whtat I'm doing:

Set docWord = objWord.Documents.Add(Template:=sWordFormsPath & "letref.dot")

.....then a bunch of processing code to fill in bookmarks and such....

Later on in the same procedure I want to do something like this:

sTemplateName = docWord.<OriginalTemplateNameFileWasCreatedFrom>

I want sTemplateName to return "letref.dot" in this case.

I know I could rearrange my code or use variables to store this at the time
of teh Set docWord line but that's a lot of trouble at the moment. I need a
quick simple solution like the one I hypothesized above.

Is this possible?

Keith
 
P

Pesach Shelnitz

Hi Keith,

Try the following line.

sTemplateName = docWord.AttachedTemplate.Name

This gives the currently attached template, which could differ from the
template with which the document was created if the attached template was
changed after the document was created.
 
K

Keith G Hicks

Thanks. I'll give that a shot.


Pesach Shelnitz said:
Hi Keith,

Try the following line.

sTemplateName = docWord.AttachedTemplate.Name

This gives the currently attached template, which could differ from the
template with which the document was created if the attached template was
changed after the document was created.
 

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