Excel VBA Automation with the use of .BAT File - Task Scheduling your work
Hi Folks,
I am currently facing a very complex problem and is pretty advance. I would really appreciate if anybody can point me to the right direction! : pray2: I will try my best to explain my situation and thanks everybody for reading my lengthly post and problems!
Process:
1. I am currently doing a full automation Project by using Window Task Scheduler to open Excel VBA File, say, every Monday 7am.
2. Once Excel File is opened, it will automatically run a .bat file that will call and run another program. This .bat file opens SAS Program (Statistical Analysis System).
Excel run the following code:
Code:
Dim x as variant
x = Shell("c:\Users\Desktop\ReportWeekly.bat")
Which then open .bat file and run the following code. The bottom code is saved in ReportWeekly.bat format.
Code:
"C:\Program Files\SASHome\SASFoundation\9.3\sas.exe" -CONFIG "C:\Program Files\SASHome\SASFoundation\9.3\nls\en\sasv9.cfg" -SYSIN "c:\Users\Desktop\Master.sas" -ICON -LOG "c:\Users\Desktop\TestingCodeSAS1.LOG"
This code opens up SAS program and run some codes which will take very long to complete.
3. Now, here come the major problem. Since .bat run a seperate program, my Excel file will never knows if my .bat has completed running SAS program. I need to do something to let my excel knows that .bat has finished running its program so that it can continue to proceed to the next step.
In a nut shell: Window Task Scheduler -> Excel -> .bat and run other program -> back to excel (tell exel that the program has completed)
Please let me know if anybody require further information or explaination. THANKS everyone for reading my post and I would really appreciate if anybody can solve my problem! :bow:
Thanks a million folks!
Cheers,
David