LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,182
Default Installing and loading AddIns in multiuser environment

Here's a vbScript that will install an addin for all users to every version of
Excel installed on the machine running the script by writing directly to the
appropriate Excel Addin Registry keys. Copy the code to a text file named
Install_MyUdf.xlam.vbs on your Desktop (or wherever you want to store it);
-double-click it to execute.

Note that addins do not have to be located in the Addins folder under the user
profile. Edit the sAddinPath string to point your MyUdf.xlam where you store
it.


Dim sAddinPath, sKey, sOpen, n, i
Dim vSZ, oWMI, vVer, vValNames, vValTypes

Const sVers = "11.0,12.0,14.0,15.0,16.0"
Const sOfficeKey = "Software\Microsoft\Office\"
Const sOptsKey = "\Excel\Options"
Const sAddinMngr = "\Excel\Add-in Manager"
Const HKCU = &H80000001
Const REG_vSZ = 1
sAddinPath = Chr(34) & "C:\MyFolder\APP\app.xlam" & Chr(34)

Set oWMI = GetObject("winmgmts:root\default:StdRegProv")
For Each vVer In Split(sVers, ",")
sKey = sOfficeKey & vVer & sOptsKey
oWMI.EnumValues HKCU, sKey, vValNames, vValTypes
If IsArray(vValNames) Then '//confirm version is installed
n = 1: sOpen = "OPEN"
For i = LBound(vValNames) To UBound(vValNames)
oWMI.GetStringValue HKCU, sKey, vValNames(i), vSZ
If Left(vValNames(i), 4) = "OPEN" Then
n = n + 1
If vSZ = sAddinPath Then
n = 0: Exit For
End If
End If 'Left(vValNames(i), 4) = "OPEN"
Next 'i

If n 0 Then
n = n - 1
If n 0 Then sOpen = sOpen & n
oWMI.SetStringValue HKCU, sKey, sOpen, sAddinPath

'Make sure to remove it from Add-in Manager
sKey = sOfficeKey & vVer & sAddinMngr
oWMI.DeleteValue HKCU, sKey, Replace(sAddinPath, Chr(34), "")
End If 'n 0
End If 'If IsArray(vValNames)
Next 'vVer
Set oWMI = Nothing

I also have an app named AddMan4XL.exe which is designed to manage workbook
addins for all versions of Excel on the host machine. It discovers all the
installed versions and lets you toggle their 'loaded' status for each
individual version. You can download its userguide to see how it works he

https://app.box.com/s/xhpauhxphpigvzafx8a7krid133iurnd

AddMan4XL needs to be updated so if you're interested to test drive it free for
30 days, post back and I'll 'git-r-done'!

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion
 
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
working with MsAccess in multiuser environment: error Cannot start KT1972 Excel Programming 1 September 30th 09 12:35 PM
loading com addins with automation Mario Excel Programming 2 June 24th 05 02:42 PM
Excel Addins Not Loading on Start Tony Tam Excel Programming 4 June 10th 05 10:20 PM
Addins not loading when opening from code Jack Excel Programming 3 February 15th 05 06:31 PM
pivotitems in a multiuser environment Kanan Excel Programming 0 March 3rd 04 05:16 PM


All times are GMT +1. The time now is 05:07 PM.

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

About Us

"It's about Microsoft Excel"