Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel Addin Install via Registry
I am trying to install an Excel addin via a logon script.
I believe I have figured out how to get it installed except 1 problem. In the below registry entry, how do you determine the X? HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\E xcel\Options String: OPENx -- CG |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel Addin Install via Registry
Loop through all of the OPENx keys, then create a new key with the next
highest x. Don't forget to delete this key when the add-in is uninstalled. - Jon ------- Jon Peltier, Microsoft Excel MVP Tutorials and Custom Solutions Peltier Technical Services, Inc. - http://PeltierTech.com _______ "CG" wrote in message ... I am trying to install an Excel addin via a logon script. I believe I have figured out how to get it installed except 1 problem. In the below registry entry, how do you determine the X? HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\E xcel\Options String: OPENx -- CG |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel Addin Install via Registry
Try something like what I've got below. Since you said, "logon script", I'm
assuming this will be part of a vbs file. If you use it as part of a VBA sub, you would want to add a few things, for example, setting objects to nothing after use. The only reason I create the object, 'objXL' was to check the version number. If you know all the PCs have version 11.0 of Office, you can skip that and still know you're looking at the correct registry key by replacing 'objXL.Version' with "11.0". _________________________ Const HKEY_CURRENT_USER = &H80000001 strComputer = "." On Error Resume Next Set objRegistry = GetObject("winmgmts:\\" & _ strComputer & "\root\default:StdRegProv") Set objXL = CreateObject("Excel.Application") strKeyPath = "Software\Microsoft\Office\" _ & objXL.Version & "\Excel\Options" objRegistry.EnumValues HKEY_CURRENT_USER, strKeyPath, _ arrValueNames, arrValueTypes a = -1 For i = 0 To UBound(arrValueNames) If Left(arrValueNames(i), 4) = "OPEN" Then a = a + 1 End If Next If a = -1 Then strNewVal = "OPEN" Else strNewVal = "OPEN" & CStr(a + 1) End If MsgBox strNewVal _________________________ Steve Yandl "CG" wrote in message ... I am trying to install an Excel addin via a logon script. I believe I have figured out how to get it installed except 1 problem. In the below registry entry, how do you determine the X? HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\E xcel\Options String: OPENx -- CG |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel Addin Install via Registry
There could be a problem if there are multiple Office versions and maybe you
better of to install via automation. RBS "CG" wrote in message ... I am trying to install an Excel addin via a logon script. I believe I have figured out how to get it installed except 1 problem. In the below registry entry, how do you determine the X? HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\E xcel\Options String: OPENx -- CG |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel Addin Install via Registry
Below is a slightly different approach (still a vbScript as opposed to a VBA
subroutine) where I use the "Excel.Application" object to not only determine the version of Excel installed but to also confirm that the add-in to be installed is present in the appropriate location on the PC and that it isn't already installed rather than checking those things reading the registry with WMI. The first line of the script needs to be edited to the file name of your add-in. If the add-in is located and if it isn't already installed, the script uses WMI to write the new registry value and the add-in gets installed. Steve Yandl _____________________________ strAddIn = "CleanHyper.xla" ' Make sure the add in is present in the file system ' Check if it is currently installed or not ' Check the version number of Excel on this PC Set objXL = CreateObject("Excel.Application") bExists = False bInstalled = False intAtotal = 0 If objXL.AddIns.Count 0 Then For a = 1 To objXL.AddIns.Count If objXL.AddIns(a).Name = strAddIn Then bExists = True If objXL.AddIns(a).Installed Then bInstalled = True End If End If ' Count total installed add-ins If objXL.AddIns(a).Installed Then intAtotal = intAtotal + 1 End If Next End If strVersion = objXL.Version Set objXL = Nothing ' Exit script if add-in file isn't available on this PC If Not bExists Then MsgBox strAddIn & " wasn't available on this PC" WScript.Quit End If ' Exit script if add-in is already installed If bInstalled Then WScript.Quit End If ' Made it this far, install the add-in If intAtotal = 0 Then strValName = "OPEN" Else strValName = "OPEN" & CStr(intAtotal) End If Const HKEY_CURRENT_USER = &H80000001 strComputer = "." On Error Resume Next Set objRegistry = GetObject("winmgmts:\\" & _ strComputer & "\root\default:StdRegProv") strKeyPath = "Software\Microsoft\Office\" _ & strVersion & "\Excel\Options" objRegistry.SetStringValue HKEY_CURRENT_USER, strKeyPath, _ strValName, strAddIn |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel Addin Install via Registry
I've used a VB6 routine (too long to post here) that looks for registry keys
9.0, 10.0, 11.0, and 12.0, and installs the appropriate OPENx keys in whichever it finds. No need for the delay in creating the Excel instance (especially if it's 12.0). - Jon ------- Jon Peltier, Microsoft Excel MVP Tutorials and Custom Solutions Peltier Technical Services, Inc. - http://PeltierTech.com _______ "Steve Yandl" wrote in message . .. Try something like what I've got below. Since you said, "logon script", I'm assuming this will be part of a vbs file. If you use it as part of a VBA sub, you would want to add a few things, for example, setting objects to nothing after use. The only reason I create the object, 'objXL' was to check the version number. If you know all the PCs have version 11.0 of Office, you can skip that and still know you're looking at the correct registry key by replacing 'objXL.Version' with "11.0". _________________________ Const HKEY_CURRENT_USER = &H80000001 strComputer = "." On Error Resume Next Set objRegistry = GetObject("winmgmts:\\" & _ strComputer & "\root\default:StdRegProv") Set objXL = CreateObject("Excel.Application") strKeyPath = "Software\Microsoft\Office\" _ & objXL.Version & "\Excel\Options" objRegistry.EnumValues HKEY_CURRENT_USER, strKeyPath, _ arrValueNames, arrValueTypes a = -1 For i = 0 To UBound(arrValueNames) If Left(arrValueNames(i), 4) = "OPEN" Then a = a + 1 End If Next If a = -1 Then strNewVal = "OPEN" Else strNewVal = "OPEN" & CStr(a + 1) End If MsgBox strNewVal _________________________ Steve Yandl "CG" wrote in message ... I am trying to install an Excel addin via a logon script. I believe I have figured out how to get it installed except 1 problem. In the below registry entry, how do you determine the X? HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\E xcel\Options String: OPENx -- CG |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel Addin Install via Registry
Jon,
I was so focused on helping the OP be able to find the x for 'OPENx' that I didn't take the time to read the VBA help for AddIns. While the Add method only makes an add-in part of the available list, you can simply set the ..Installed property to True to install it. I have not tested but I suspect that will be as fast or faster than using script to write to the registry, even though it does involved creating the Excel instance. Steve "Jon Peltier" wrote in message ... I've used a VB6 routine (too long to post here) that looks for registry keys 9.0, 10.0, 11.0, and 12.0, and installs the appropriate OPENx keys in whichever it finds. No need for the delay in creating the Excel instance (especially if it's 12.0). - Jon ------- Jon Peltier, Microsoft Excel MVP Tutorials and Custom Solutions Peltier Technical Services, Inc. - http://PeltierTech.com _______ "Steve Yandl" wrote in message . .. Try something like what I've got below. Since you said, "logon script", I'm assuming this will be part of a vbs file. If you use it as part of a VBA sub, you would want to add a few things, for example, setting objects to nothing after use. The only reason I create the object, 'objXL' was to check the version number. If you know all the PCs have version 11.0 of Office, you can skip that and still know you're looking at the correct registry key by replacing 'objXL.Version' with "11.0". _________________________ Const HKEY_CURRENT_USER = &H80000001 strComputer = "." On Error Resume Next Set objRegistry = GetObject("winmgmts:\\" & _ strComputer & "\root\default:StdRegProv") Set objXL = CreateObject("Excel.Application") strKeyPath = "Software\Microsoft\Office\" _ & objXL.Version & "\Excel\Options" objRegistry.EnumValues HKEY_CURRENT_USER, strKeyPath, _ arrValueNames, arrValueTypes a = -1 For i = 0 To UBound(arrValueNames) If Left(arrValueNames(i), 4) = "OPEN" Then a = a + 1 End If Next If a = -1 Then strNewVal = "OPEN" Else strNewVal = "OPEN" & CStr(a + 1) End If MsgBox strNewVal _________________________ Steve Yandl "CG" wrote in message ... I am trying to install an Excel addin via a logon script. I believe I have figured out how to get it installed except 1 problem. In the below registry entry, how do you determine the X? HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\E xcel\Options String: OPENx -- CG |
#8
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel Addin Install via Registry
Nope, I've done it both ways, and the VB or other script runs much more
quickly (way under a second) than opening an Excel instance (several seconds or dozens of seconds). Using the Excel instance is easier, because then you don't have to figure out what registry entries you need, but it's much slower. - Jon ------- Jon Peltier, Microsoft Excel MVP Tutorials and Custom Solutions Peltier Technical Services, Inc. - http://PeltierTech.com _______ "Steve Yandl" wrote in message . .. Jon, I was so focused on helping the OP be able to find the x for 'OPENx' that I didn't take the time to read the VBA help for AddIns. While the Add method only makes an add-in part of the available list, you can simply set the .Installed property to True to install it. I have not tested but I suspect that will be as fast or faster than using script to write to the registry, even though it does involved creating the Excel instance. Steve "Jon Peltier" wrote in message ... I've used a VB6 routine (too long to post here) that looks for registry keys 9.0, 10.0, 11.0, and 12.0, and installs the appropriate OPENx keys in whichever it finds. No need for the delay in creating the Excel instance (especially if it's 12.0). - Jon ------- Jon Peltier, Microsoft Excel MVP Tutorials and Custom Solutions Peltier Technical Services, Inc. - http://PeltierTech.com _______ "Steve Yandl" wrote in message . .. Try something like what I've got below. Since you said, "logon script", I'm assuming this will be part of a vbs file. If you use it as part of a VBA sub, you would want to add a few things, for example, setting objects to nothing after use. The only reason I create the object, 'objXL' was to check the version number. If you know all the PCs have version 11.0 of Office, you can skip that and still know you're looking at the correct registry key by replacing 'objXL.Version' with "11.0". _________________________ Const HKEY_CURRENT_USER = &H80000001 strComputer = "." On Error Resume Next Set objRegistry = GetObject("winmgmts:\\" & _ strComputer & "\root\default:StdRegProv") Set objXL = CreateObject("Excel.Application") strKeyPath = "Software\Microsoft\Office\" _ & objXL.Version & "\Excel\Options" objRegistry.EnumValues HKEY_CURRENT_USER, strKeyPath, _ arrValueNames, arrValueTypes a = -1 For i = 0 To UBound(arrValueNames) If Left(arrValueNames(i), 4) = "OPEN" Then a = a + 1 End If Next If a = -1 Then strNewVal = "OPEN" Else strNewVal = "OPEN" & CStr(a + 1) End If MsgBox strNewVal _________________________ Steve Yandl "CG" wrote in message ... I am trying to install an Excel addin via a logon script. I believe I have figured out how to get it installed except 1 problem. In the below registry entry, how do you determine the X? HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\E xcel\Options String: OPENx -- CG |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Addin Install | Excel Programming | |||
Cancel Addin Install from Workbook_AddinInstall? | Excel Programming | |||
Save & Install AddIn with VBA | Excel Programming | |||
Install Addin in Excel | Excel Programming | |||
Cannot install Excel 2002 Analysis Addin Toolpak | Excel Programming |