Skip to content
本页内容

ListIndex (属性)

返回或设置列表框或组合框中当前选定项的索引号。int 类型,可读写。

说明

不能将该属性应用于多选列表框。

示例

python
#本示例删除列表框中选定的数据项。如果 `Shapes.Item(2)` 代表的不是列表框,则本示例将无效
def test():
    controlFormat = Worksheets.Item(1).Shapes.Item(2).ControlFormat
    controlFormat.RemoveItem(controlFormat.ListIndex)
python
#本示例显示活动工作表的第一个形状(列表框)当前选定项的索引号
def test():
    shape = ActiveSheet.Shapes.Item(1)
    print(shape.ControlFormat.ListIndex)