Properties Collection Example

The next example enumerates the Forms collection and prints the name of each open form in the Forms collection. It then enumerates the Properties collection of each form and prints the name of each property and value.

Sub AllOpenForms()
    Dim frm As Form, prp As Property

    ' Enumerate Forms collection.
    For Each frm In Forms
        ' Print name of form.
        Debug.Print frm.Name
        ' Enumerate Properties collection of each form.
        For Each prp In frm.Properties
            ' Print name of each property.
            Debug.Print prp.Name; " = "; prp.Value
        Next prp
    Next frm
End Sub