Home |
Search |
Today's Posts |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
working with MsAccess in multiuser environment: error Cannot start | Excel Programming | |||
loading com addins with automation | Excel Programming | |||
Excel Addins Not Loading on Start | Excel Programming | |||
Addins not loading when opening from code | Excel Programming | |||
pivotitems in a multiuser environment | Excel Programming |