Results 1 to 3 of 3
  1. #1
    Lounger
    Join Date
    Mar 2005
    Posts
    34
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Auto insert footer (Word 2002 SP3)

    How can I set Word/Excel to automatically enter the filename/path as the footer. I don't want to have to do this manually. I wan't every doc whenever it is saved to automatically insert this footer, and update whenever the file is moved. We have so many users that never put the filename/path on their documents, so we never now where to find the original. This would be very helpful.

    Thanks in advance.

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Auto insert footer (Word 2002 SP3)

    The first strategy is to replace everyone's templates with templates that have the customized footer. This doesn't address the "Save As" problem, when people revise an old document, not based on your template, as the basis for a new document.

    The second strategy is to intercept certain Word commands, such as Open and Save As and Print, and run some custom code that automatically inserts or updates the footer before, during or after carrying out the user's instruction (as the case may be!). Our document management system came supplied with custom global templates that do something like this. In fact, we've layered a "do not do that" option on top of it for people who want to send out unidentified documents!

    I don't have any specific concise code samples handy (the DMS templates are only half-converted from WordBasic and are such a mess that you would not want to use them as an example), but on this board and the VBA board we've had a lot of threads regarding how to use VBA procedures to insert information into headers and footers, and how to intercept and replace the FileSaveAs and FilePrint and FilePrintDefault commands.

    Added: I just noticed this --

    > update whenever the file is moved

    -- and the way you can handle this is to use a field code in the footer, rather than hard coding the path so that the next time the document is printed, it will show the "current" path. There's no convenient way to refresh the path in advance when a file is moved by Windows; in theory there are ways to quietly open Word in the background every time a DOC file is moved, but I'm fairly certain that it would be a nightmare to actually implement that.

  3. #3
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,852
    Thanks
    4
    Thanked 259 Times in 239 Posts

    Re: Auto insert footer (Word 2002 SP3)

    There isn't a magic bullet to do this for large numbers of existing files - this is going to take considerable work to come up with a comprehensive solution that doesn't break existing file contents.

    In Word this can be done by modifying the templates used to include a {FILENAME p} field in the footers. This won't fix any existing files - or those created by SaveAs from an existing file. Therefore you will need a macro to put this field into existing files (after first checking that the field is not already there). The nature of sections in Word means that each file potentially needs the field added to 3 footers per section if you want the field to appear on every page.

    The same principle applies to Excel. Your templates can include a footer with the &[Path]&[ File ] fields. Again, any existing files will need a macro to add this to the footer after checking that the fields are not already there. The macro will need to act on all workbooks in each file.

    In earlier versions of Excel there was no filepath type field so this problem needed to be solved by a macro that needed to be run anytime the filename or path was changed. John Walkenbach's site contained a macro for earlier versions of Excel.
    Andrew Lockton, Chrysalis Design, Melbourne Australia

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •