Expands or collapses an item.
Type | Description | |||
Name as Variant | A string expression that indicates the property's name, or a long expression that indicates the property's identifier. | |||
Boolean | A boolean expression that indicates whether the item is expanded or collapsed. True means that the item is expanded, and False means that the item is collapsed. |
Use the ExpandItem property to expand or collapse an item. Use the ID property to determine the property's identifier. Use the Name property to retrieve the property's name. Use the ExpandAll method to expand all items. Use the ExpandOnSearch property to expand items automatically while user types characters to search for a specific property.
The following samples collapses the "Appearance" item:
Private Type POINTAPI x As Long y As Long End Type Private Type MSG hwnd As Long message As Long wParam As Long lParam As Long time As Long pt As POINTAPI End Type Private Declare Function PeekMessage Lib "user32" Alias "PeekMessageA" (lpMsg As MSG, ByVal hwnd As Long, ByVal wMsgFilterMin As Long, ByVal wMsgFilterMax As Long, ByVal wRemoveMsg As Long) As Long Private Const PM_NOREMOVE = &H0 Private Declare Function TranslateMessage Lib "user32" (lpMsg As MSG) As Long Private Declare Function DispatchMessage Lib "user32" Alias "DispatchMessageA" (lpMsg As MSG) As Long Private Sub Form_Load() With PropertiesList1 .BeginUpdate .HasLines = False .ShowCategories = True .MarkCategories = True .Select PropertiesList1.Object ' When using the Select method, the list of properties is not immediately available, so we need to proceeds few messages Dim m As MSG While PeekMessage(m, .hwnd, 0, 0, 1) TranslateMessage m DispatchMessage m Wend .ExpandItem("Appearance") = False .EndUpdate End With End Sub