Graham Mayor

... helping to ease the lives of Microsoft Word users.


Many people access the material from this web site daily. Most just take what they want and run. That's OK, provided they are not selling on the material as their own; however if your productivity gains from the material you have used, a donation from the money you have saved would help to ensure the continued availability of this resource. Click the appropriate button above to access PayPal.

Insert Filename or Filename & Path in a document

Word includes the ability to insert the filename or the filename and path in a document, by means of a FILENAME field. Some versions of Word already have the option included to insert an auto text entry containing the filename field, but some users seem to have difficulty with this, so on a wet day in May, I put together an add-in to try and simplify the process.

Unfortunately, as is so often the case, the implementation proved rather more complex than I had anticipated, however the add-in described below does, I believe, take all the thinking out of the task and requires no knowledge of fields or Autotext/Building blocks to make it work.

Installing the add-in template in the Word startup folder (a self extracting installer is included) adds a button to the Add-ins tab of the ribbon of recent Word versions.

The add-in checks the document to establish whether there is an existing filename field present, and if found displays an option to update the field, or to delete it prior to replacing it. The initial version of the add-in allows only one filename field to be inserted in the document. If there is a demand for the field to be inserted in more than one location, I may modify the add-in to allow that, but I envisage the use to be primarily that of inserting the filename at the end of the document.

If 'Update' is selected any Filename field present in the document will be updated. If 'Remove' is selected, all filename fields in the document are removed and the user is presented with the following dialog, which allows the placement and formatting of the filename in the document.

Settings chosen by the user (the defaults are those illustrated) are retained in the add-in template for further use.

As with all my add-ins I have included a disclaimer which is presented on first use of the add-in, and thereafter if the 'Show disclaimer on startup' check box remains checked.

The add-in reads the values it uses from the template itself, so it is important not to edit the template

 

- Click here to download the add-in

 

 Insert Filename

A simple process to insert the document's filename or filename and path at a location of your choice.

This add-in is compatible with Word versions 2007 to 2016. It has not been tested with the 64 bit version of Word.

Dialogs shown are from Word 2010 - the dialog box sizes are slightly different when used in Word 2013/2016.