943,940 Members | Top Members by Rank

Ad:
  • Python Discussion Thread
  • Unsolved
  • Views: 4670
  • Python RSS
Dec 29th, 2006
0

Excel Add-In RegisterXLL

Expand Post »
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.
Python Syntax (Toggle Plain Text)
  1. import os
  2. from win32com.client import Dispatch
  3. os.system (install "setup.exe" in silent mode)
  4. xlApp = Dispatch("Excel.Application")
  5. xlApp.RegisterXLL(xll)
  6. xlApp.Visible = 1
  7. wb=xlApp.Workbooks.Add()
  8. xlApp.Workbooks.Open(xla).RunAutoMacros(1)
  9. xlApp.ActiveSheet.Cells(1,1).Formula = '=xversion()'
  10. wb.Close(SaveChanges=0)
  11. xlApp.Quit()
  12. xlApp.Visible = 0
  13. del xlApp
  14. os.system (uninstall "setup.exe" in silent mode)
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
bud594 is offline Offline
2 posts
since Dec 2006
Dec 30th, 2006
0

Re: Excel Add-In RegisterXLL

Where does the variable xll come from?
Moderator
Reputation Points: 1333
Solved Threads: 1403
DaniWeb's Hypocrite
vegaseat is offline Offline
5,792 posts
since Oct 2004
Dec 30th, 2006
0

Re: Excel Add-In RegisterXLL

xll is the full path of the xll file and xla is the full path of the xla file.

I am a little confused though, even with the xlApp.Quit() and del xlApp there is still an excel.exe visible in the taks manager. If this is running before the script starts then it works, if it is not then it fails.


Click to Expand / Collapse  Quote originally posted by vegaseat ...
Where does the variable xll come from?
Reputation Points: 10
Solved Threads: 0
Newbie Poster
bud594 is offline Offline
2 posts
since Dec 2006

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Python Forum Timeline: list in another list
Next Thread in Python Forum Timeline: Newbie Help





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC