Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
tjh tjh is offline
external usenet poster
 
Posts: 96
Default Addin Install

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 a
"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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Addin Install

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 a
"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

  #3   Report Post  
Posted to microsoft.public.excel.programming
tjh tjh is offline
external usenet poster
 
Posts: 96
Default Addin Install

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 a
"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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Addin Install

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" wrote in message
...
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

a
"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



  #5   Report Post  
Posted to microsoft.public.excel.programming
GS GS is offline
external usenet poster
 
Posts: 364
Default Addin Install

Hi tjh,
Not all application alerts can be suppressed with .DisplayAlerts!

Note that the Add method of the Addins collection supports an option Boolean
argument for the copy. Set it to TRUE or FALSE as desired, to suppress the
prompt.

Also note that the CopyFile method has an optional Boolean argument to
overwrite an existing file with the same name. Setting this to TRUE will
simply copy the file (replacing any existing one with the same name).

<FWIW If you're just looking for a simple way to update users' addins, I
suggest you use the same filename and put version/release info in its Summary
Properties. This will display in the tooltip in explorer windows. If the
addin is already installed, the next time Excel is opened it will look for
the same filename but get the new version you just put in the source folder.
...No need here to re-install it!

The message you say you're getting indicates that Excel is attempting to
copy the file to the user's addins folder. I think it would be better to
store it in its own folder under "Program Files" if on a local machine. If
it's stored on a network drive, any user-accessible location for its folder
will do. When asked if you want to copy it to the user's addin folder, say NO
to this prompt because:
1. You want all users on the network referencing the same file from the
server location. This makes maintenance easier for you because there's only
one file to update.
2. You want the same addin available to all users of a local machine (I
would think).

Note that you can overwrite an addin file at any time, but it won't be
current for your users until their copy of Excel is re-opened.

As for distribution:
I'm not sure why you're trying to install it programmatically, but using
TOOLS, ADD-INS, BROWSE... will get it done even for the most novice user.
Putting a simple instruction in a text file would be equally effective, and
it's one less addin for you to maintain. Alternatively, for your updates, a
Winzip Self-Extracting file works nice for stand-alone machines.

HTH
Regards,
Garry
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cancel Addin Install from Workbook_AddinInstall? Dave Ramage Excel Programming 3 April 28th 06 02:01 PM
Addin - 1. Links & 2. Install/Uninstall Error Message MSweetG222 Excel Programming 0 March 15th 06 03:33 AM
Save & Install AddIn with VBA Matt Excel Programming 1 September 23rd 04 03:40 PM
Install Addin in Excel Jos Vens Excel Programming 0 July 8th 04 11:18 PM
Cannot install Excel 2002 Analysis Addin Toolpak robbyn Excel Programming 2 January 30th 04 11:41 PM


All times are GMT +1. The time now is 06:02 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"