简体   繁体   English

Listbox.Selected 显示运行时错误“-2147024809(80070057)”

[英]Listbox.Selected shows run time error '-2147024809(80070057)'

I have a listbox which is set to multi select. When I use listbox.selected to check the item selection status、I get the run time error.我有一个设置为 multi select 的列表框。当我使用 listbox.selected 检查项目选择状态、我得到运行时错误。 Run-time error '-2147024809(80070057)':Could not get selected property.运行时错误“-2147024809(80070057)”:无法获取所选属性。 Invalid argument.无效的论点。

There are 55 items set in the listbox.列表框中设置了 55 个项目。 And when i=25, the error happens.当 i=25 时,错误发生。 What is the cause of this error?这个错误的原因是什么?

' Add item to listbox
with me
    For i = LBound(arr) To UBound(arr)
      .ListBox1.AddItem arr(i)
    Next
End With

' Check listbox
with me
    arr = Array()
    For i = 0 To .ListBox1.ListCount - 1
      If .ListBox1.Selected(i) = False Then    <-Error happen here
        ReDim Preserve arr(UBound(arr) + 1)
        arr(UBound(arr)) = .ListBox1.List(i)
      End If
    Next
End With

The error disappeared after recreating the form and all related processing,重新创建表单和所有相关处理后错误消失,

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 ListBox.Selected无法正常工作; 运行时错误&#39;-2147024809(80070057) - ListBox.Selected is not working; Run-time error '-2147024809(80070057) 运行时错误&#39;-2147024809(80070057)&#39;具有不稳定的行为 - Run-time error '-2147024809 (80070057)' with erratic behavior 运行时错误-2147024809(80070057)指定的值超出形状范围 - run time error -2147024809 (80070057) the specified value is out of range with shape clsCommandButton:Microsoft Excel VBA-运行时错误&#39;-2147024809(80070057)&#39; - clsCommandButton: Microsoft Excel VBA - Run-Time Error '-2147024809 (80070057)' 运行时错误“-2147024809(80070057)”指定的值超出范围 - run time error '-2147024809(80070057)' the specified value is out of range 更改共享工作簿上的按钮文本:运行时错误“-2147024809 (80070057)” - Changing button text on a shared workbook: Run-Time Error '-2147024809 (80070057)' 将Excel数据导入PowerPoint幻灯片-运行时错误&#39;-2147024809(80070057)&#39;:指定的值超出范围 - Importing Excel data into PowerPoint slides - Run-time error '-2147024809 (80070057)': The specified value is out of range 旧代码1004、424,-2147024809中的新运行时错误(80070057) - New run time errors in older code 1004, 424, -2147024809 (80070057) 运行时错误-2147024809(80070057):调整形状 - runtime error -2147024809 (80070057): Resizing shape Excel VBA-listbox.selected属性导致错误 - Excel VBA - listbox.selected property causing error
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM