> What if the addin exist on the users computer,
> but is not installed? How should I check for this?
Under on error resume next attempt to set a reference
set adn = addins(sTitle)
where sTitle is the title in file/properties if it has one, otherwise the
name without extension
If the ref succeeds then check its installed property.
You could also check if it's loaded, which it may or may not be irrespective
as to whether it's in the addins collection and/or installed (user could
have loaded from an icon or manually or unloaded)
Note that addins in the collection, whether or not installed, are defined by
only the title, not path. Eg if you try to do this -
set adn = addins.add("C:\myAddin.xla")
adn.installed = true
- and there's another addin with same title (note title) in another folder
that's in the collection then a ref will be set to that addin to be
installed and load if not already - not yours.
It's worth setting a unique title, eg "My Addin v12,34"
Regards,
Peter T
"tjh" <(E-Mail Removed)> wrote in message
news:E4E39C9E-A157-4558-96AF-(E-Mail Removed)...
> Yes, in many cases I would be re-versioning the addin. However for new
users
> it would be an initial setup. What if the addin exist on the users
computer,
> but is not installed? How should I check for this? Also, concerning
deleting
> the add-in would that code be somewhat like:
> Application.AddIns.delete Filename:=(the file name on the users C drive
> under application data)
>
> Thank you,
>
>
>
>
>
>
> "Jim Thomlinson" wrote:
>
> > Check if the addin is currently installed. If it is then uninstall it
and
> > delete it. You can then add your new addin version back with no problems
(I
> > assume you are re-versioning the addin?)...
> > --
> > HTH...
> >
> > Jim Thomlinson
> >
> >
> > "tjh" wrote:
> >
> > > Yesterday you helped me to determine how to install an add-in through
vba,
> > > thank you for that.
> > >
> > > Now I am trying to get past the alert boxes which ask if I would like
to
> > > overwrite the add-in if it currently exists. The two messages I get
are:
> > > "Copy XXXX.xla to the add-ins folder?" (Yes/No/Cancel), and "A file
named
> > > XXXX.xla already exists. Do you want to replace it?" (Yes/No/Cancel).
> > >
> > > Is there a way to program the code not to ask these questions? It will
not
> > > work if I set Application.DisplayAlerts = False because it defaults to
> > > answering "No." Or at least the way I have it running. How can I
correct the
> > > code to answer "Yes," but not display the alerts? Below is an example
of what
> > > I am currently using.
> > >
> > > Thank You,
> > >
> > > Sub AdinInstall1A()
> > >
> > > Application.DisplayAlerts = False
> > >
> > > On Error Resume Next
> > > Application.AddIns.Add Filename:="C:\XXXX.xla"
> > > Application.AddIns("XXXX").Installed = True
> > >
> > > Application.DisplayAlerts = True
> > >
> > > End Sub
|