The other approach I tried (as suggested by Tim, thanks) involves
browsing the ROT.

import pythoncom
SPREADSHEET_NAME = r'\MySpreadsheet.xls'
lenstr = len(SPREADSHEET_NAME)
obj = None
rot = pythoncom.GetRunningObjectTable()
rotenum = rot.EnumRunning()
while True:
        monikers = rotenum.Next()
        if not monikers: break
        ctx = pythoncom.CreateBindCtx(0)
        name = monikers[0].GetDisplayName(ctx, None);
        if name[-lenstr:] == SPREADSHEET_NAME:
                obj = rot.GetObject(monikers[0])
                break

The obj I get is a PyIUnknown... How do I use it?

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to