使用-vba向下滚动列表框时Excel锁定 [英] Excel locking up when scrolling listbox down with - vba

查看:187
本文介绍了使用-vba向下滚动列表框时Excel锁定的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

有谁知道答案,为什么在列表框上向下滚动鼠标时excel会关闭?我应该在属性中进行任何调整吗?谢谢.

已从评论中移除-LOSMAC [/EDIT]

我使用的是excel 2007,这是列表框上使用的代码,当我选择单个目录名称时,它会用目录名称填充.其他列表框将用文件名称填充,并且每当我激活列表框并选择项目并滚动时按下鼠标,我将使整个工作簿进入关闭和文件恢复模式.有什么方法可以防止在选择项目时向下滚动吗?或任何其他解决方案.谢谢.

Hello,

Dose anyone know the answer why excel closes down when scrolling down the mouse on listbox? Is there anything I should adjust in the properties? Thanks.

Moved from comment - LOSMAC[/EDIT]

I am using excel 2007, and this is the code used on listbox and it is populated with directories names when I select single directory name other list box will be populated with files names, and whenever I have the listbox active and item is selected and scroll down the mouse I will have the entire workbook goes into closing down and file recovery mode. Is there any way to prevent scrolling down while items are selected? or any other solutions. Thank.

Private Sub ListBox2_Click()
Dim strFile As String
Dim i As Integer

Me.ListBox1.Clear
For i = 0 To Me.ListBox2.ListCount - 1
    If Me.ListBox2.Selected(i) Then
         strFile = Dir("C:\Users\hawari\Documents\TLC\" & Me.ListBox2.Text & "\*.xls")
         Do While Len(strFile) > 0
             ListBox1.AddItem strFile
             strFile = Dir
         Loop
    End If
Next
End Sub

推荐答案

我认为,错误原因不在过程"ListBox2_Click"中.
您的文件可能已损坏.您需要将用户表单导出到文件中/右键单击编译器窗口左侧的用户表单,然后创建新的Excel文件并从文件中导入用户表单.
我希望这会有所帮助.如果没有,请尝试按照DaveAuld所说的重新安装(修复)MS Office.
In my opinion, the reason of error is not in the procedure "ListBox2_Click".
Probably your file is corrupted. You need to export userform(s) into file(s) /use right click on the userform on the left side of the compilator''s window/, then create new Excel file and import the userform(s) from file(s).
I hope, it would be helpful. If not, try to reinstall (repair) MS Office, as DaveAuld said.


这篇关于使用-vba向下滚动列表框时Excel锁定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆