Driving Excel itself

COM & pywin32

win32com on Windows: ranges, refreshes, dialogs and closing Excel cleanly.

The COM automation lifecycle with pywin32: dispatch Excel, open the workbook, act on it, then save and quit in a finally block so no orphan process remains.The COM automation lifecycle with pywin32: dispatch Excel, open the workbook, act on it, then save and quit in a finally block so no orphan process remains.open, act, and always quitDispatchExcel.ApplicationVisible = FalseActranges · refreshrun macrosQuitin finally:no orphan EXCEL.EXE

Start with the full guides

The long-form treatment of com & pywin32, with the reasoning the shorter pages assume.

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.

When it breaks

The errors this topic produces, with the cause explained rather than just the fix.

Follow it through a track

Prefer an ordered route? These tracks cover com & pywin32 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.

COM & pywin32 is part of Driving Excel itself.