Visio 对象的 VBA 动画
我正在尝试使用循环为 Visio 对象设置动画,例如:
For reposition = 2 To 6
xpos = reposition
ypos = reposition
sh1.SetCenter xpos, ypos
Sleep 1000
Next reposition
虽然这确实将对象从起始位置移动到结束位置,但中间步骤不可见。 延迟后仅显示最终位置。
如果我在循环中放置一个 MsgBox
,那么每个中间位置都是可见的,但必须单击一个分散注意力的中心位置框才能看到这些位置。
如何在没有用户交互和模式窗口覆盖屏幕的情况下使流程可见?
I'm trying to animate Visio objects with a loop, such as:
For reposition = 2 To 6
xpos = reposition
ypos = reposition
sh1.SetCenter xpos, ypos
Sleep 1000
Next reposition
While this DOES move the object from the starting position to the ending, the intermediate steps are not visible. After a delay only the final position is displayed.
If I put a MsgBox
in the loop then each intermediate position is visible but one must click a distracting, center-positioned box in order to see these.
How can I make the flow visible without user interaction and covering of the screen by a modal window?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
睡觉前尝试使用
DoEvents
语句Try a
DoEvents
statement before your sleep谢谢,DJ!
效果非常好。 为了下一个需要示例的人的利益,下面是我的代码,它移动已放置在 Visio 网格上的进程图标并显示连续运动(动画)(查看预览,似乎我的缩进已被消除) ):
Thanks, DJ!
That worked perfectly. For the benefit of the next person who needs an example, below is my code which moves a process icon which has been placed on a Visio grid and shows the continuous motion (animation) (looking at the preview it seems that my indentation has been eliminated):
确保您已将 Application.Screenupdating 设置为 true...我有一个类似的宏,可以对形状进行动画处理,并且我不需要使用 DoEvents 来更新屏幕...
Make sure you have Application.Screenupdating set to true...I have a similar macro that animates a shape and I don't need to use DoEvents to update the screen...