Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

File name and path in template

Status
Not open for further replies.

teebird

Technical User
Dec 11, 2001
239
Hi All

I am trying to add the filename and path to my template. It is visible when I first set it up in the template but when I open a new document from the template, only the document name appears eg Document 1 - not the full path even when I save it and reopen it.

I am using this merge file.

{FILENAME \p \* MERGEFORMAT}

I have also added this code to my AutoNew code.

Selection.TypeText ActiveDocument.FullName
 
Hi Teebird,

Until a document is saved, it has no path property to report, and all you'll get is a name like 'Document1'.

As for the field coding, I suggest dropping the '\* MERGEFORMAT' switch - this sometimes causes problems if the field is formatted differently from the underlying paragraph and the field result increases.

Cheers

[MS MVP - Word]
 
As macropod mentions, until a document is saved it does not have a name, or path. Perhaps if you tell us exactly what you want to do.

Why are you using AutoNew? What is it for? Why do you want to to have the filename typed, rather than use a field? If it is coming from a template (.dot) file, it may be better to use the Document_New event in the template. But again, perhaps if you describe what you want to achieve.

Gerry
My paintings and sculpture
 
Many thanks for your replies.
I finally got the FileName/Path to work. I am using AutoNew to work my prompt boxes (ASK and REF fields).

As these are seperate to the normal templates, I did not want to put the FileName/Path merge field into that document.

I didn't want to type it - I wanted it to be added autiomatically.

Anyway - all's well.

Many thanks again.



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top