Answer» I need some help in figuring out how to do the following with VBA in Excel and batch file EXECUTION. Here's the scenario:
++ I have a batch file which uses 2 arguments (%1 %2) to do an XCopy. ++ Using Excel I want to programatically, using Shell to run through each populated row in the spreadsheet (Column A has the source / Column B has the destination). ---------------------- ++ Here's the rub - Excel VBA doesn't seem to know that I've got 1 Shell running so that if I have multiple rows, each ONE pops up, i.e. if I have say 10 source folders that I want to copy to 10 different destination folders, then I have 10 cmd.exe's running at the same time. ----------------------- ++ What I'd like to know is if there is a WAY in VBA to not execute the next shell unless the last one is finished?
Any help would be greatly appreciated.
Thanks in advance
OldMarineGruntYou might be better off using Windows Script for this. By creating an Excel object, the script can READ a row, setup the parameters for XCOPY and run each, waiting for one to finish or launch them without waiting.
By the way, XCOPY is a external command and does not need to run with the CMD shell.
More info on Windows Script can be found at Script Center. Check out the HEY Scripting Guy and Office Space links to the archives for some ideas.
Hope this helps. Thanks. I'll give it a shot.Try using the VBA FileCopy command. Look in the Access VBA help. Call me OldNavyGuy
|