Two Question

M

MarkS

Hi,
I have this shell command in VBA
x = Shell("cmd.exe /c dir /Tw/S " & sPath & "*." & LCase(sFileExtension) &
" > " & _
ThisWorkbook.Path & "\Directory.txt", 1)
which works fine, but i need to wait until it has finished running before
going to the next command

I use Sheets("Directory").Delete to delete this sheet but it asks if I
want to delete this sheets, how do I get rid of the message.

Thanks MarkS
 
D

Dave Peterson

#1.

If you're lucky and you know that your .cmd file always takes less than x
seconds, you could add application.wait (x + 30% seconds)
(or whatever you feel comfortable with.)

But there are other ways.

http://support.microsoft.com/?kbid=214248
XL2000: How to Force Macro Code to Wait for Outside Procedure
or

Here's a link to a nice ShellAndWait function that does that.
http://groups.google.com/groups?threadm=ump2dlfcBHA.1656@tkmsftngp03

#2.

application.displayalerts = false
'delete the sheet
application.displayalerts = true
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top