Skip to content
本页内容

ListCount (属性)

返回列表框或者组合框中数据项的数目。如果列表中没有数据项,则返回 0(零)。int 类型,只读。

示例

python
#本示例对组合框进行调整,使其可以显示列表中的所有数据项。如果第一个形状不代表组合框,则本示例无效
def test():
    controlFormat = Worksheets.Item(1).Shapes.Item(1).ControlFormat
    controlFormat.DropDownLines = controlFormat.ListCount
python
#本示例显示活动工作表的第二个形状(列表框)数据项的数目
def test():
    shape = ActiveSheet.Shapes.Item(2)
    print(shape.ControlFormat.ListCount)