|
|
Title | Use VBA code to display a Word document's built in document properties |
Description | This example shows how to use VBA code to display a Word document's built in document properties. |
Keywords | Word, VBA, properties, document properties |
Categories | Office |
|
|
Subroutine ShowBuiltInDocumentProperties loops through the document's BuiltInDocumentProperties collection, displaying the property values in the Debug window.
|
|
' Display the active document's built-in properties.
Public Sub ShowBuiltInDocumentProperties()
Dim dp As DocumentProperty
On Error Resume Next
For Each dp In ActiveDocument.BuiltInDocumentProperties
Debug.Print dp.Name & ": ";
Debug.Print dp.Value
If Err.Number <> 0 Then
Debug.Print "??????????"
Err.Clear
End If
Next dp
End Sub
|
|
The results display some possibly sensitive information such as author name, company name, last save date, and last print date.
For more information on programming the Microsoft Office applications with VBA code, see my book Microsoft Office Programming: A Guide for Experienced Developers.
|
|
|
|
|
|