Tell App to wait for number of seconds
and
Execute command and wait for it (Shell does not wait)
Sub WaitFor(Seconds2Wait)
Application.wait DateAdd("s", Seconds2Wait, Now)
' Below also works
' Application.Wait (Now + TimeValue("0:00:1"))
End Sub
Sub ShellWait(Fullcmd)
' Run external app and wait for it. Shell DOES NOT wait for external app to finish
' Lines below will wait
Set oShell = CreateObject("WSCript.shell")
oShell.Run FullCmd, 1, True ' "C:\Windows\system32\calc.exe", 1, True
MsgBox "Done?"
End Sub
Application.wait DateAdd("s", Seconds2Wait, Now)
' Below also works
' Application.Wait (Now + TimeValue("0:00:1"))
End Sub
Sub ShellWait(Fullcmd)
' Run external app and wait for it. Shell DOES NOT wait for external app to finish
' Lines below will wait
Set oShell = CreateObject("WSCript.shell")
oShell.Run FullCmd, 1, True ' "C:\Windows\system32\calc.exe", 1, True
MsgBox "Done?"
End Sub
Seconds2Wait
or
Fullcmd
or
Fullcmd
Views 4,462
Downloads 1,379
CodeID
DB ID