property Items.CellCaption([Item as Variant], [ColIndex as Variant]) as Variant

Retrieves or sets the text displayed on a specific cell.

 TypeDescription 
   Item as Variant A long expression that indicates the item's handle.  
   ColIndex as Variant A long expression that indicates the cell's handle or the column's index, a string expression that indicates the column's caption or the column's key.  
   Variant A string expression that indicates the cell's caption.  
The CellCaption property specifies the cell's caption. To associate an user data for a cell you can use CellData property. The CellCaptionFormat property specifies whether the cell's caption displays a simple text, uses built-in HTML tags, or indicates a computed field.  Use the ItemData property to associate an extra data to an item. Use the Visible property of the Column object to hide a column. The AddItem method specifies also the caption for the first cell in the item. Use the <img> HTML tag to insert icons inside the cell's caption, if the CellCaptionFormat property is exHTML. Use the CellImage or CellImages property to assign an icon to a cell. Use the CellPicture property to assign a custom size picture to a cell. Use the ConditionalFormats method to apply formats to a cell or range of cells, and have that formatting change depending on the value of the cell or the value of a formula. The exComputedField type specifies a computed cell.

Note: The intersection of an item with a column defines a cell. Each cell is uniquely represented by its handle. The cell's handle is of HCELL type, that's equivalent with a long type. All properties of Items object that have two parameters Item and ColIndex, refer a cell.

The following lines are equivalents and each of them changes the bold font attribute of the first cell on the first item.

With ComboBox1
    .Items.CellBold(, .Items.ItemCell(.Items(0), 0)) = True
    .Items.CellBold(.Items(0), 0) = True
    .Items.CellBold(.Items(0)) = True
    .Items.CellBold(.Items.ItemByIndex(0)) = True
    .Items.CellBold(.Items.ItemByIndex(0), 0) = True
    .Items.CellBold(.Items(0), ComboBox1.Columns(0).Caption) = True
End With

 


Send comments on this topic.
1999-2017 Exontrol.COM, Software. All rights reserved.