这在VBA中看起来很奇怪,但我很好奇,所以请听我说。 我创建了一个在点击时在屏幕上移动图像的过程。尽管如此,它仍然有效,但仍然有效 - 它很有用。避免阻止用户与表单的交互 - 访问VBA 2007
下面是代码:
'Start primitive animation
Private Sub imgBean_Click()
'Limit for movement to right
Dim coordinates, limit As Integer
coordinates = 0
limit = Form.Width
Do While coordinates < limit
coordinates = coordinates + 5
'Move the image
Me.imgBean.Move coordinates
'Needed to add this to see the image move - updates the form
Form.Repaint
Loop
Debug.Print "Coordinates " & coordinates
Debug.Print limit
'Reset the limit
limit = 0
End Sub
正如所说的代码工作之前 - 但同时,图像移动屏幕被冻结,即我不能关闭的形式或与其他成分相互作用。 (这类似于阻止Android环境中的UI线程 - 你永远不会这么做!)
那么有没有办法避免这种情况?
谢谢
P.S.将焦点设置为表单会使图像偶尔出现并消失。
说实话,微软Access并不是特别认可他的多任务功能。我与大多数VBA应用程序(无论是Access,Excel还是Outlook)都有同样的问题。 – dnLL
@dnLL我知道但我认为我有机会:P – Katana24
excel支持多线程isnt – 2013-05-16 14:47:22