How to save XLSM file with Macro, using openpyxl

For me this worked, together with version openpyxl==2.3.0-b2

wb = load_workbook(filename="original.xlsm", read_only=False, keep_vba=True)
..
wb.save('outfile.xlsm')

It is also mentioend in the documentation here: http://openpyxl.readthedocs.org/en/latest/usage.html?highlight=keep_vba#write-a-workbook-from-xltm-as-xlsm

Leave a Comment