PDA

View Full Version : How to run external software run multiple files after each other using VBA (in Excel)



Martin7919
02-11-2018, 02:10 AM
Hi all,

I am not very experienced with VBA and I have a question about accessing files from software using Excel.
I have multiple files with need to be executed. Every file takes about a day to complete. However, in the weekend this means that part of the weekend is not used, as only one file can be executed at a time.
To run the multiple files, I have to select the file manually in the software and execute it by clicking the run button or hit F9.

Is there a way to run multiple files after each other using VBA from within Excel? Excel could list the files in a folder which need to run in series. I know how to open a single file but not how to run them in series and check whether every file has been successfully finished. Also, when hitting the run button/F9, there might be a 'warning' message box, for which the user needs to click 'ok'. I know this can be done with SENDKEYS but I have no idea how this works. The message box needs to have focus etc.




Path = "C:\Test1.otx"

CreateObject("Shell.Application").Open (Path)



Can anybody help me with this?

Regards,
Martin

Paul_Hossler
02-11-2018, 10:36 AM
This might help

http://www.vbaexpress.com/forum/showthread.php?54630-Shell-and-Wait-32-bit-and-64-bit


Personally, though, if I was running a series of programs, I'd use a VBScript (.VBS) file and not VBA. I don't know PowerShell, but VBS is like a batch file on steroids

If you have access to the runned programs code, you could probably tweak it a bit to be more unattended-run friendly