Hi, I have a python program that constantly updates an excel spreadsheet. I would like to be able to view its updates while using excel to edit other excel files. Below are the test codes I have:
-------------------------------------------------------------------------------------- from time import sleep import win32com.client as w32c def test(): w32c.pythoncom.CoInitialize() print w32c.pythoncom._GetInterfaceCount() app1 = w32c.Dispatch("Excel.Application") #app1.Visible=False #app1.Interactive = False wb=app1.Workbooks.Open("c:\\temp\\Book1.xls") sleep(3) sh=wb.Sheets("Sheet1") sh.Cells(2,1).Value = "Hello, world!" sh = None wb.Save() wb = None app1 = None w32c.pythoncom.CoUninitialize() print w32c.pythoncom._GetInterfaceCount() ------------------------------------------------------------------------------------- If the user just looks at the file then it's fine, but if the user double clicks one cell, which will have a cursor flashing in the cell, then it will lead to a crash of the program with error: "Call was rejected by callee." I can make the program keep trying to access the file, but if the user doesn't make the flashing cursor disappear, the program will wait forever! I know excel has the fuction such that when a user is accessing a file and other users open that file, it will prompt for options of opening it as read-only or sending notification. I have been trying to implement that in the program, but don't know how. So, any suggestion will be greatly appreciated! - Barry -- http://mail.python.org/mailman/listinfo/python-list