View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Jon Peltier Jon Peltier is offline
external usenet poster
 
Posts: 6,582
Default 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