'Is there a batch program that can open one XLSM file, process it, save the file, close the file and then open another XLSM file?

I have three xlsm files that I'd like to batch process sequentially (i.e. a.xlms, b.xlms, c.xlms)

They are contained in "c:\xlsm_batch" folder

I've used this batch code to run the files and it WORKS .... BUT DOES NOT save them or close them once they have been run sequentially.

@echo off for %%x in (C:\xlsm_batch*.xlsm) do ( echo Starting.. %%x start "" /wait %%x )

Is there a way to program this into the code (i.e. saving each sequential XLSM file, closing each sequential XLSM file and then opening up a NEW XLSM file for processing?)

Thanks, R



Solution 1:[1]

So the line sorted(zip(y1, x1)) in the first part of the code seems to be sorting according to y1.

What you can do is use the the key argument of sorted to replicate that behaviour

y2_sorted, x2_sorted = zip(*sorted(zip(y2, x2), key=lambda _: _[0]))
print(y2_sorted)
# (1, 3, 3, 6, 7, 8)
print(x2_sorted)
# (array([2, 3, 1, 4, 5, 6]), array([1, 3, 2, 4, 5, 6]), array([3, 1, 2, 4, 5, 6]), array([1, 2, 3, 4, 5, 6]), array([2, 1, 3, 4, 5, 6]), array([3, 2, 1, 4, 5, 6]))

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 niko