Current Template File Path / Location

B

Bobby V

Hi

I am trying to retrieve the current document location from a document
template via a Macro when a user opens a Word Template ( dot ) file.

This is an example of code I am using:

Sub Document_Open()

MsgBox ActiveDocument.Path & Application.PathSeparator & _
ActiveDocument.Name

End Sub

This output only displays '\Document' if run with in a template file (.dot).

If however it is run with in a Document file (.doc) then it displays the
full path eg

C:\MyDocuments\Document

Any ideas on how I can resolve this ?
 
C

Cindy M.

Hi =?Utf-8?B?Qm9iYnkgVg==?=,

I'm not sure what the question is. I think you need to be more specific about
what you mean by "opens a Word Template (dot) file". Generally, templates
aren't meant to be opened by the user; a new file is generated from them. This
triggers the Document_New event (and AutoNew macro, if any is present).

What confuses me about your problem description is that document_open is
apparently running, anyway? Or are you running it "manually"?

And what information do you really want to show? A new document hasn't been
saved yet, so there is no file location...
I am trying to retrieve the current document location from a document
template via a Macro when a user opens a Word Template ( dot ) file.

This is an example of code I am using:

Sub Document_Open()

MsgBox ActiveDocument.Path & Application.PathSeparator & _
ActiveDocument.Name

End Sub

This output only displays '\Document' if run with in a template file (.dot).

If however it is run with in a Document file (.doc) then it displays the
full path eg

C:\MyDocuments\Document

Any ideas on how I can resolve this ?

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :)
 
B

Bobby V

Cindy,

Cheers for your response. I thought this would be the case. It make sense
that the file hasn't been saved so it doesn't contain a location as of yet.

Thanks

Bobby V
 

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