Type | Description | |||
ID as Variant | A long expression that indicates the item's identifier, or a string expression that indicates the item's caption searched for. | |||
Item | An Item object that defines the menu item. |
The following VB sample recursively enumerates all items in the menu:
Private Sub scan(ByVal e As EXMENULibCtl.Menu) If Not (e Is Nothing) Then Dim i As EXMENULibCtl.Item For Each i In e Debug.Print i.Caption scan i.SubMenu Next End If End Sub
Or an alternative function without using for each statement will be:
Private Sub scan(ByVal e As EXMENULibCtl.Menu) If Not (e Is Nothing) Then Dim j As Long For j = 0 To e.Count - 1 Debug.Print e.ItemByIndex(j).Caption scan e.ItemByIndex(j).SubMenu Next End If End Sub