|
Post by drybsmt on Dec 6, 2018 11:34:37 GMT
I have three Excel files that contain data that is drawn from other files. Every week I need to open the file so they update and then close the files after a few seconds. I am new to MMM and could use some guidance please. It would also be nice if the macro could run automatically at a specified time without user intervention. I have the MMM Pro if that makes a difference.
|
|
|
Post by Steve on Dec 6, 2018 22:27:12 GMT
Hi, The macro example opens three excel files, waits 10 seconds, then closes all excel windows open. 1 | RUN ACTION | RUN PROGRAM | D:\Macro\OUTPUT\workbook1.xlsx 2 | RUN ACTION | RUN PROGRAM | D:\Macro\OUTPUT\workbook2.xlsx 3 | RUN ACTION | RUN PROGRAM | D:\Macro\OUTPUT\workbook3.xlsx 4 | RUN ACTION | WAIT SECONDS | 10 5 | RUN ACTION | KILL PROCESS NAME | excel Is this what you are after? To schedule a macro to run at a time check out the FAQ link here ( FAQ - Schedule a macro). For this to work you will need to save the macro using the 'save' macro button as a .mmmacro file.
|
|
|
Post by drybsmt on Dec 12, 2018 11:19:35 GMT
Thanks Steve,
I am working on just one file to open right now to get it working and adjusted to allow for a couple of popups and adjusted script like this:
1 | RUN ACTION | RUN PROGRAM | D:\Dropbox (DRYBSMT)\~Employee Information\Payroll Archive\2018 Archive\Annual Totals and Stat Calculation.xlsx 2 | RUN ACTION | WAIT SECONDS | 5 3 | 1476 | 615 | 1641 | Keypress enter 4 | RUN ACTION | WAIT SECONDS | 2 5 | 1476 | 615 | 1641 | Keypress enter 6 | RUN ACTION | WAIT SECONDS | 10 7 | RUN ACTION | KILL PROCESS NAME | excel
The file opens and popups are dealt with but excel does not close. Thoughts?
|
|
|
Post by Steve on Dec 12, 2018 21:30:30 GMT
The '5 | RUN ACTION | KILL PROCESS NAME | excel' should be killing the process. Not sure why this is not working for you.
There are alternatives:
7 | RUN ACTION | RUN VIA CMD /C | taskkill /F /IM excel.exe - Run taskkill and manually force the process closed.
7 | X | X | 500 | Keypress ALT+ | F4 - ALT+F4 to kill the selected window
|
|
|
Post by drybsmt on Dec 13, 2018 2:12:45 GMT
These both work but I think the advantage to the first one is that I can open all three and then shut it down whereas I think the Alt F4 would have to be done before opening the next file.
The only foreseeable issue would be if I had other workbooks open when the macro runs. So maybe I will use the Alt F4 option.
Thanks for the help Steve.
|
|