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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

auto insert filepath

Status
Not open for further replies.

myrzo

Instructor
Dec 23, 2003
22
IE
When working in a ms word document can you switch on a feature that automatically inserts the filepath and filename
without having to set it in the footer?

Myriam
 
Create a macro called "AutoOpen" in Normal.dot,
insert this:
Code:
Sub AutoOpen()
Selection.TypeText ActiveDocument.FullName
End Sub

That's it... ;-)
Andy


Andreas Galambos
EDP / Technical Support Specialist
(andreas.galambos@bowneglobal.de)
HP:
 
Hi Andreas,

That will add it to every document once each time it is opened, which I'm sure isn't wanted. [wink]

Myriam,

You could try using [blue]AutoNew()[/blue] instead of AutoOpen().

You could also base your documents on a template which has the name in. Where do you want this? And do you want it only on new documents, or added to existing ones as well (which is harder)?

Enjoy,
Tony

--------------------------------------------------------------------------------------------
We want to help you; help us to do it by reading this: Before you ask a question.
 
Yeah, right Tony.
Posted before thinking... :-D
Myrzo said:
can you switch on a feature
You can also
[ul][li]create a new doc[/li]
[li]add the macro (with any name other than "Auto...)[/li]
[li]save it as something.dot[/li]
[li]Select Tools - customize[/li]
[li]create a new toolbar[/li]
[li]make sure to select "save in yournewdoc.dot"[/li]
[li]drag/drop your macro as a button on that toolbar[/li]
[/ul]
If you now add the dot to your "templates and add-ins", a click on the button will insert file name/path.

Would that be an option?
Andy
 
For any document you can use 'Insert|Field|Document Information|Filename' and add a /p switch to the field (available also under 'Options|Field Specific Switches'

You can insert the field anywhere in the document that you can enter text - body, header footer, textbox etc.

Cheers
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top