热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

Excel中VBA程序,listbox无法获取属性问题。

http:club.excelhome.netattachment.php?aid547411&ka8733eac0c32f9966665cb2a3e8ae328&t124
http://club.excelhome.net/attachment.php?aid=547411&k=a8733eac0c32f9966665cb2a3e8ae328&t=1247455398
上面那个是文件的地址。
在文件中,双击SHEET3的2、3列可以弹出一个小的窗口,里面有一段小程序。
点击确定以后就会弹出如题错误。
类似的程序我在VB下运行没问题。
请教高手帮忙解决下,谢谢!~

2 个解决方案

#1


这个是因为超过了listbox的边界

Private Sub CommandButton1_Click()
Dim j As Integer
Dim result As String
If ListBox1.ListCount > 1 Then
    For j = 0 To  ListBox1.ListCount - 1        If ListBox1.Selected(j) = True Then
            If j = ListBox1.ListCount - 1 Then
                result = result & ListBox1.List(j)
            Else
                result = result & ListBox1.List(j) & "¡¢"
            End If
        End If
    Next
End If
If result <> "" Then
    MsgBox result
End If

End Sub

#2


可以重启     试试看

推荐阅读
author-avatar
七月de七月小
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有