Introduction

In my Working with Word ebook (the 4th edition is available now), there is code that lists (among other things) the document properties in a Word document. This is useful information, but sometimes you need to know which of the doc properties have actually been used; that is what the code in the sample database for this article does.

The Form

The sample database, Listing Used Doc Props (AA 245).accdb, has only one form, a simple menu:

Figure A. The main menu of the sample database

There is a button for listing the used doc properties, either in a single document or a folder. If you select the Folder option, the folder selector button is enabled so you can select the folder containing the documents to process.

VBA Code

Clicking the List Used Doc Properties button runs one of the procedures listed below:

When the procedure finishes, the text file listing the used doc properties in the selected document opens (for folder processing, just the first text file opens). Note that there can be lots more doc properties in a document than are actually used – this will happen, for example, if you have a standard template prefilled with all the doc props that might be used, but a template copied from this template will only use a few.

One document I tested has over 100 doc props:

Figure B. A selection of the doc props in a document

But only a few are actually used.

Figure C. A text file listing the used doc props in a document

References

The code in the sample database needs the following references (in addition to the default references):

If you import code or objects into a database of your own, you may need to set one or more of these references. The version number may differ, depending on your Office version; check the version you have. References are set in the References dialog, opened from the VBA window. For more information on working with references, see Access Archon #107, Working with References.

Supporting Files

The zip file containing this article, in Word 97-2003 format, plus the supporting file(s), may be downloaded from the Access Archon page of my Web site, as accarch245.zip, which is the last entry in the table of Access Archon columns for Access Watch.

Document Name

Document Type

Place in

Listing Used Doc Props (AA 245).accdb

Access 2007-2010 database (can also be used in higher versions of Access)