title: Get name of active Excel workbook from Python
body: <p>I am trying to write a Python script that will access and modify the active Excel workbook using the Excel COM interface. However, I am having difficulty getting this to work when there are multiple Excel instances running. For example, the code</p>
  
  <pre><code>import win32com.client
  
  xl = win32com.client.Dispatch("Excel.Application")
  print(xl.ActiveWorkbook.FullName)
  </code></pre>
  
  <p>prints out the name of the active workbook from the first running instance of Excel only. What I really want is the workbook that I last clicked on, regardless of what Excel instance it was in.</p>
  
  <p>Thanks.</p>