Wednesday, December 15, 2010

Filename Field Code in Word

Many times I'll use a field code to insert the filename into the footer of a document. The field code looks like this:

{ FILENAME \*MERGEFORMAT}

The result of the field code looks like this: foobar.doc

The filename has a ".doc" suffix. When I create the PDF, the filename in the footer still has the ".doc" suffix, and not ".pdf".

What I found is that the field code uses the filename exactly as it appears in the Windows Explorer window. This may sound trivial, but to solve the problem we just need to hide the extension in Windows Explorer.

To change the setting follow these steps:
  1. Open Windows Explorer
  2. Click Tools -> Folder Options
  3. Click on the View tab
  4. Check Hide extensions for known file types
Now, after updating the field code, we get foobar instead of foobar.doc.

[Source Wordribbon.Tips.net]