[python-win32] excel xla runautomacros
Tim Roberts
timr at probo.com
Wed Apr 25 19:02:28 CEST 2007
mjohnson wrote:
> I am having a problem with an excel add-in which is installed via
> xlApp.Workbooks.Open("C:/Program
> Files/Program/XLOF32.xla").RunAutoMacros(1)
>
> I can then add the add-in and install it via
> xlApp.AddIns.Add ("C:/Program Files/Program/XLOF32.xla",True)
> xlApp.AddIns.Item(Index='Excel Functions').Installed=True
>
> My problem is that the macro may have already been run, which
> generates a dialog warning that it is already open.
>
> The question, is there a way of detecting whether the add-in is
> already open?
Well, xlApp.AddIns is a collection. You should be able to query the
collection item by item and check to see whether the add-in is present.
I'm leaving the code as "an exercise for the reader", but something like
this should be possible:
for addin in range( xlApp.AddIns.Count ):
if xlApp.AddIns.item(addin).Filename???
I don't know exactly which property you'd need to query.
--
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.
More information about the Python-win32
mailing list