简体   繁体   English

如何在两个不同的工作表中的一组按键和鼠标事件之间延迟

[英]How to delay between to sets of keystrokes and mouse events in two different sheets

What is the way to delay two session of mouse events and key strokes in Excel? 在Excel中延迟两个会话的鼠标事件和按键的方式是什么? let say I perform two session in two different sheets: 假设我在两个不同的工作表中执行两个会话:

sheet 1: 工作表1:

right click -> key stroke R -> write 100 chars -> press enter

after that: 之后:

switch to sheet 2: 切换至工作表2:

right click -> key stroke R -> write 100 chars -> press enter

I used this delay but it seems that only the second sets of commands happens 我使用了此延迟,但似乎仅发生第二组命令

Application.Wait DateAdd("s", 10, Now)

maybe you can try "onTime"? 也许您可以尝试“ onTime”? And I cannot reproduce your problem. 我无法重现您的问题。 Would you mind posting more codes? 您介意发布更多代码吗?

Sub testing()
macroA
Application.OnTime DateAdd("s", 2, Now), "macroB"
End Sub

Sub macroA()
MsgBox "A"
End Sub
Public Sub macroB()
MsgBox "B"
End Sub

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM