Driving Excel itself

Macros & VBA

Running macros from Python, keeping .xlsm files intact, and replacing VBA with Python.

Running VBA from Python: open the macro-enabled workbook, call the macro by name through xlwings or COM, and keep the VBA intact when saving.Running VBA from Python: open the macro-enabled workbook, call the macro by name through xlwings or COM, and keep the VBA intact when saving.keep the macro, drive it from Pythonbook.xlsmVBA projectkeep_vba=TrueRun macroxlwings · COMby nameSavestill .xlsmmacros intact

Step-by-step how-tos

One task each, with code you can copy, run and adapt.

Compare the options

Which tool or approach to pick, and why.

Follow it through a track

Prefer an ordered route? These tracks cover macros & vba along the way, in the order that builds on itself.

Related topics

Subjects that keep turning up on the same pages as this one, most overlap first.

Macros & VBA is part of Driving Excel itself.