To identify the properties associated with an object, you write code to iterate through the object’s Properties collection, retrieving the information you want. Some special cases when referencing properties may be problematic:
The following code displays each of the properties of each User object in the current Workspace. After it has tried to retrieve the property value, it checks to see if an error has occurred, and if so, checks the specific error number. If the error is anticipated, as in the case of trying to retrieve a write-only property (error 3251), error text is printed. If the error isn’t anticipated, the code displays a message to the user.
Dim usr As User Dim prp As Property Dim varValue As Variant For Each usr In Workspaces(0).Users For Each prp In usr.Properties ' Disable error handling. On Error Resume Next varValue = prp.Value ' See if an error occurred. Select Case Err Case 3251 ' Operation not supported error. Debug.Print prp.Name & ": <Error " & Err _ & ": " & Err.Description & ">" Case 0 ' No error. Debug.Print prp.Name & ": " & varValue Case Else ' Unanticipated error. MsgBox "Error: " & Err & vbCrLf & Err.Description End Select Err.Clear ' Re-enable error handling. On Error GoTo 0 Next prp Debug.Print Next usr