Hussain Jiwani wrote:
> Following is a snippet of code that I have been using to figure out if
> an addin in installed.
>
>         xlApp = win32com.client.dynamic.Dispatch('Excel.Application')
>         xlApp.DisplayAlerts = 0
>         xlApp.Interactive = 1
>         if xlApp.Application.Addins.Count <= 0:
>             print "Terminating: No add_ins are available"
>             xlApp.quit
>             return 0
>
>         # Addin name should be Analysis ToolPak or Analys32
>         lnAddins=0
>         for ia in range(1, xlApp.Application.Addins.Count):
>   

That stops one too soon.  Remember that range(1,4) returns [1,2,3].  You
should either use range(xlApp.Application.AddIns.Count) and refer to
AddIns(ia+1), or you should use range(1, xlApp.Application.AddIns.Count+1)

-- 
Tim Roberts, [EMAIL PROTECTED]
Providenza & Boekelheide, Inc.

_______________________________________________
Python-win32 mailing list
Python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to