View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Peter T Peter T is offline
external usenet poster
 
Posts: 5,600
Default change path to an add-in

What you describe relates to the problem there is no direct way in VBA to
"Remove" an addin from the collection, and what I was trying to explain
previously. When you reinstall it from a new folder, the collection will
continue to "think" it is still in the old location. Also it will probably
not install by doing ad.Installed = True (after loading and re-adding to the
collection from it's new location).

Manually the way fully uninstall from the collection is to uncheck it,
remove it from file, attempt to re-check it, then accept the prompt to have
it removed from the list. I vaguely recall someone suggesting SendKeys to do
that but I've never tried.

With code, the only way to fully "remove" from the collection is by writing
to the registry (unless the addin is in a default library folder which makes
things easier). Indeed this can be done with a VB6 app, KeepItCool posted
full code in this ng to do just that (Excel must be closed). If you don't
want to go that route, try doing it along the lines I suggested - in two
sessions. Should work but will end up with the old defunct entry in the
non-installed list of addins in the registry (harmless clutter).

Note with addins "(un)Install" has two distinct meanings, install into the
addins collection and install such that it will auto-load at start-up.
Further, an addin can be installed in both senses yet not necessarily
loaded.

Regards,
Peter T


"Brian Murphy" wrote in message
...
The addin contains the following in its Auto_Open

Application.AddIns.Add ThisWorkbook.FullName

This puts the addin in the list in the Add-Ins dialog box, with the
check box empty.
If I close and reopen excel, it's still in the list. This is what I
want as it "installs" the addin for me.

If the addin is then opened manually from another folder, that .Add
statement above gets run and this seems to redirect the addin as being
installed from the second folder, but closing and reopening excel
shows that it's still "installed" from the first folder. This is not
what I want.

What is the right and proper way to "install" and "uninstall" an
addin. In this case I don't have to worry about links to UDF's in the
addin because this addin isn't used for that sort of thing. Can
registry settings be easily changed for any excel version?

Could a small VB6 program be used to launch one or more instances of
Excel to do the uninstalling and installing?

Thanks,

Brian