Adds a Column object to the collection and returns a reference to the newly created
object.
Type | Description | |||
ColumnCaption as String | A string expression that indicates the caption for the column being added |
Return | Description | |||
Variant | A Column object that indicates the newly added column. |
The AddColumn event is fired when a new columns is added to Columns collection. Use the Caption property to change the column's caption.
The following sample shows how to add columns to your group based on a recordset:
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 .BeginUpdate .ColumnAutoResize = False ' Add the columns With .Columns For Each f In rs.Fields .Add f.Name Next End With ' Adds items .PutItems rs.getRows() .EndUpdate End With End With