I seem to have an intermittent issue with the following code segment. I am installing an application which has an associated excel add in which I register and then run the on open macro. The formula then calls one of the functions from the add-in.
The script fails at the RegisterXLL step, reporting "AttributeError: Excel.Application.RegisterXLL", and then after failing for a number of times it will succeed until I reboot after which time it will commence failing again for a number of iterations following which it will work.
If I run the script and let it fail and then comment out the install step the script works.
This is running on both Win2K and WinXP o/s and both Excel 2000 and 2003. Any ideas gratefully received.
import os from win32com.client import Dispatch os.system (install "setup.exe" in silent mode) xlApp = Dispatch("Excel.Application") xlApp.RegisterXLL(xll) xlApp.Visible = 1 wb=xlApp.Workbooks.Add() xlApp.Workbooks.Open(xla).RunAutoMacros(1) xlApp.ActiveSheet.Cells(1,1).Formula = '=xversion()' wb.Close(SaveChanges=0) xlApp.Quit() xlApp.Visible = 0 del xlApp os.system (uninstall "setup.exe" in silent mode)