I have the following VBA code:
Set wshshell = CreateObject("WScript.Shell")
wshshell.SendKeys "{F3}"
WScript.Sleep 1000
I get the following error on the WSCript.Sleep
line:
Run time error 424: Object required
I have the following VBA code:
Set wshshell = CreateObject("WScript.Shell")
wshshell.SendKeys "{F3}"
WScript.Sleep 1000
I get the following error on the WSCript.Sleep
line:
Run time error 424: Object required
WScript.Sleep
only runs when used inside scripting host controls. VBA doesn't support it. You can, however use the following example to delay.
#If VBA7 Then
Declare PtrSafe Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
#Else
Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
#End If
Sub Test()
MsgBox "one"
Sleep 1000
MsgBox "Two"
End Sub