User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Python section within the Software Development category of DaniWeb, a massive community of 423,955 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 4,179 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Python advertiser: Programming Forums
Views: 2113 | Replies: 2
Reply
Join Date: Dec 2006
Posts: 2
Reputation: bud594 is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
bud594 bud594 is offline Offline
Newbie Poster

Excel Add-In RegisterXLL

  #1  
Dec 29th, 2006
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)
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Oct 2004
Location: Mojave Desert
Posts: 2,466
Reputation: vegaseat will become famous soon enough vegaseat will become famous soon enough 
Rep Power: 10
Solved Threads: 176
Moderator
vegaseat's Avatar
vegaseat vegaseat is offline Offline
Kickbutt Moderator

Re: Excel Add-In RegisterXLL

  #2  
Dec 30th, 2006
Where does the variable xll come from?
May 'the Google' be with you!
Reply With Quote  
Join Date: Dec 2006
Posts: 2
Reputation: bud594 is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
bud594 bud594 is offline Offline
Newbie Poster

Re: Excel Add-In RegisterXLL

  #3  
Dec 30th, 2006
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.


Originally Posted by vegaseat View Post
Where does the variable xll come from?
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb Python Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the Python Forum

All times are GMT -4. The time now is 6:21 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC