0

When I open Excel from the cmd line with the "excel" command, then win32com.client.GetActiveObject("Excel.Application") returns the Excel object I'd expect.

But when I open Excel with a new instance, with "excel /x" from the Command Prompt, then Python doesn't recognize Excel.Application.

My guess is the COM application name is different when opening it this way (e.g. something like Excel.Application2). How can I find out what the COM application name is?

I am calling this Python code from a VBA call to the Shell, so ideally I would like to find the relevant Excel.Application name that called that VBA.

(I've tried digging around the registry and haven't figured it out yet.)

Eliyahu
  • 158
  • 3
  • 11
  • Does this answer your question? [How to reference the COM objects of all the running Excel application instances, including hidden and without workbooks?](https://stackoverflow.com/questions/63562678/how-to-reference-the-com-objects-of-all-the-running-excel-application-instances) – Axe319 May 08 '23 at 17:39

0 Answers0