Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
C# Helper...
 
XML RSS Feed
Follow VBHelper on Twitter
 
 
 
MSDN Visual Basic Community
 
 
 
 
 
TitleUse VBA code to display a Word document's built in document properties
DescriptionThis example shows how to use VBA code to display a Word document's built in document properties.
KeywordsWord, VBA, properties, document properties
CategoriesOffice
 
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.

 
 
Copyright © 1997-2010 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated