Word Security Risk? Find Hidden Fields!

When you Share or modify Word files - you can get OTHER PEOPLE's  names, IDs and personal information!  WORSE yet, you can GIVE others your own personal or proprietary info! How to Find these fields?  How to replace or purge them?

The macro at bottom of this page performs a checkup of common fields.

The top of the page shows you screenshots of how to find these fields in WinWord (Word for Windows®) via (a) shortcut "Alt-I-F" (b) Menu Tab "Insert" and (c) Macro Message box

(a) shortcut Alt-I-F
(a) shortcut Alt-I-F
(b) Menu Tab ''Insert''
(b) Menu Tab ''Insert''
c) Macro WordDocProperties Message box
c) Macro WordDocProperties Message box

Sub WordDocProperties()
Dim strTemp, strProp, strNameList As String
Dim thisRange   'strNameList used to bypass error thrown by at least one of the named properties
strNameList = "title,subject,author,last author,company,manager,Last Save time,Creation Date,Comments,Total Editing Time" 
'short list for demo. See menu [screenshot (b) above] in Word® for full list
xyz = Split(strNameList, ",")
Set thisRange = ActiveDocument.Content
 thisRange.Collapse Direction:=wdCollapseEnd ' wdCollapseStart is default per https://msdn.microsoft.com/en-us/library/office/ff840825(v=office.15).aspx
For Each Prop In ActiveDocument.BuiltInDocumentProperties '.CustomDocumentProperties BuiltInDocumentProperties
  With thisRange
    On Error Resume Next
    strProp = Prop.Name 'here, at least one property throws an error not trapped by 'on error'
    If Err.Number Then strProp = " n/a " ' this never happens: see above
' strTemp = strTemp & vbCrLf & Prop.Name 'for deriving full namelist
    If IsNumeric(findElementinArray(Prop.Name, xyz)) Then strTemp = strTemp & vbCrLf & Prop.Name & " = " & Prop.Value
    On Error GoTo 0
 End With
Next
 MsgBox strTemp, , "Sub WordDocProperties"
End Sub
'--------
Function findElementinArray(someString, someArray) 'returns index of found item, else "" if not found
Dim kounter, i, j, k As Integer
findElementinArray = ""
    For k = LBound(someArray) To UBound(someArray)
        If UCase(someString) = UCase(someArray(k)) Then
            findElementinArray = k
            Exit For
        End If
    Next k
End Function

A macro to Purge or SetWordDocProperties will be available 2017-April-02 in the "Office Macro Package"