vba - How To Programmatically Wait For Shell Command To Finish Running? -


i sending emails in program so:

call shell(smtppath, emailinput...) 

this works great, except if call function twice, function runs first time, calls shell command, function runs again, , calls shell command again, first shell command not completed, there error because second shell command trying use same smtp file first 1 (that still in use).

how can make function wait until shell command has finished running?

addendum: or there way can see if file being used, , if is, sleep it, try again?

you use wscript.shell, , it's run method:

set objshell = createobject("wscript.shell") result = objshell.run(smtppath & " " & emailinput, 0, true) 

Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -