method Items.AddItem ([Caption as Variant])

Adds a new item, and returns a handle to the newly created item.

TypeDescription
Caption as Variant A string expression that indicates the cell's caption for the first column. or a safe array that contains the captions for each column. The Caption accepts HTML format, if the CellCaptionFormat property is exHTML.
ReturnDescription
HITEMA long expression that indicates the handle of the newly created item.

Use the AddItem property when your group acts like a list. Use InsertItem when your group looks like a tree. Use the InsertControlItem property when the item needs to host an ActiveX control. The AddItem property adds a new item that has no parent. When a new item is added (inserted) to the Items collection, the control fires the AddItem event. If the group contains more than one column use the CellCaption property to set the cell's caption. If there are no columns the AddItem method fails. By default, the group adds a default column. Use the LockedItemCount property to lock or unlock items to the top or bottom side of the group. Use the MergeCells method to combine two or more cells in a single cell. Use the SplitCell property to split a cell.

The following sample uses the VB Array function to add two items: 

With ExplorerTree1
    With .Groups.Add("Group 1")
        .BeginUpdate
        
            .Columns.Add "Column 1"
            .Columns.Add "Column 2"
            .Columns.Add "Column 3"
            
            With .Items
                .AddItem Array("Item 1.1", "Item 1.2", "Item 1.3")
                .AddItem Array("Item 2.1", "Item 2.2", "Item 2.3")
            End With
            
        .EndUpdate
    End With
End With  

Use the PutItems method to load an array, like in the following sample:

With ExplorerTree1
    With .Groups.Add("Group 1")
        Set rs = CreateObject("ADODB.Recordset")
        rs.Open "Orders", "Provider=Microsoft.Jet.OLEDB.3.51;Data Source= D:\Program Files\Microsoft Visual Studio\VB98\NWIND.MDB", 3 ' Opens the table using static mode
        .ColumnAutoResize = False
        .HeaderVisible = True
        .BeginUpdate
            ' Add the columns
            With .Columns
                ' By default the control adds a column, so we delete it first
                .Clear
                For Each f In rs.Fields
                    .Add f.Name
                Next
            End With
            .PutItems rs.getRows()
        .EndUpdate
    End With
End With