Add-in automatically loads for all users of the machine?
The scenario:
Machine's "Administrator" logs into a machine and installs our
application, an Add-in for Excel.
The installer writes to the HKCU area of the registry to automatically
load the Add-in when Excel is launched.
FYI, the reg path is:
"HKCU\Software\Microsoft\Office\8.0\Excel\Options" and reg value
"OPEN" "example.xla"
When another user logs into the machine and launches Excel the Add-in
is, obviously, not automatically loaded. They have to manually load it
via the menu.
This is being deemed unacceptable by the QA group.
1. I thought running Active setup it would solve the problem, but not.
2. Moreover I added this registry key under HKLM, even though it's not loading the add-in when another user logs into machine.
Can someone please tell me where the installer should write to in the
registry so the Add-in automatically loads for all users of the machine?
Appreciated if problem solved by ur valuable suggestion.
Thanks,
Sourav.
Machine's "Administrator" logs into a machine and installs our
application, an Add-in for Excel.
The installer writes to the HKCU area of the registry to automatically
load the Add-in when Excel is launched.
FYI, the reg path is:
"HKCU\Software\Microsoft\Office\8.0\Excel\Options" and reg value
"OPEN" "example.xla"
When another user logs into the machine and launches Excel the Add-in
is, obviously, not automatically loaded. They have to manually load it
via the menu.
This is being deemed unacceptable by the QA group.
1. I thought running Active setup it would solve the problem, but not.
2. Moreover I added this registry key under HKLM, even though it's not loading the add-in when another user logs into machine.
Can someone please tell me where the installer should write to in the
registry so the Add-in automatically loads for all users of the machine?
Appreciated if problem solved by ur valuable suggestion.
Thanks,
Sourav.
0 Comments
[ + ] Show comments
Answers (3)
Please log in to answer
Posted by:
anonymous_9363
16 years ago
I'm willing to bet that your users already have an entry for the 'OPEN' value. Add-ins are added sequentially so, if an 'OPEN' value already exists, the next one needs to be added as 'OPEN1', the next one as 'OPEN2' and so on. You cannot program this behaviour natively in the MSI so you'll need a script-driven Custom Action.
Ignore the lash-up scripts you'll find on web searches which attempt to enumerate the 'OPEN' values: you will find it an order of magnitude easier to use the Excel Application object's AddIn method. IIRC, there's a script posted here on AppDeploy.
Ignore the lash-up scripts you'll find on web searches which attempt to enumerate the 'OPEN' values: you will find it an order of magnitude easier to use the Excel Application object's AddIn method. IIRC, there's a script posted here on AppDeploy.
Posted by:
sourav
16 years ago
VbScab, absolutely I was thinking it should add for all users, but there is no key present in users machine.
In this regard I used below CA, while installing the installer.
On Error Resume Next
Set objShell = CreateObject("WScript.Shell")
strPlugin = """C:\Program Files\Application\ExcelAddin.xla""" 'This is the name of your Excel Addin
strExcelRegistryKey = "HKCU\Software\Microsoft\Office\11.0\Excel\Options" 'Becareful of your Office version here!
intCount = 0
intCompleted = 0
If objShell.RegRead(strExcelRegistryKey & "\Open") = "" Then
objShell.RegWrite strExcelRegistryKey & "\Open", strPlugin, "REG_SZ"
intCompleted = 1
End If
If intCompleted <> 1 Then
Err.Clear
Do Until Err.number = -2147024894
intCount = intCount + 1
strRegKey = strExcelRegistryKey & "\Open" & intCount
strRegKeyValue = objShell.RegRead(strRegKey)
Loop
objShell.RegWrite strExcelRegistryKey & "\Open" & intCount, strPlugin, "REG_SZ"
End If
Set objShell = Nothing
By the way it is adding registry to admin and it automatically
loads the Add-in when Excel is launched. But the other users it's not adding the OPEN Key.
I troubleshooted many ways, please help me guys.
Thanks,
Sourav.
In this regard I used below CA, while installing the installer.
On Error Resume Next
Set objShell = CreateObject("WScript.Shell")
strPlugin = """C:\Program Files\Application\ExcelAddin.xla""" 'This is the name of your Excel Addin
strExcelRegistryKey = "HKCU\Software\Microsoft\Office\11.0\Excel\Options" 'Becareful of your Office version here!
intCount = 0
intCompleted = 0
If objShell.RegRead(strExcelRegistryKey & "\Open") = "" Then
objShell.RegWrite strExcelRegistryKey & "\Open", strPlugin, "REG_SZ"
intCompleted = 1
End If
If intCompleted <> 1 Then
Err.Clear
Do Until Err.number = -2147024894
intCount = intCount + 1
strRegKey = strExcelRegistryKey & "\Open" & intCount
strRegKeyValue = objShell.RegRead(strRegKey)
Loop
objShell.RegWrite strExcelRegistryKey & "\Open" & intCount, strPlugin, "REG_SZ"
End If
Set objShell = Nothing
By the way it is adding registry to admin and it automatically
loads the Add-in when Excel is launched. But the other users it's not adding the OPEN Key.
I troubleshooted many ways, please help me guys.
Thanks,
Sourav.
Posted by:
Robo Scripter
16 years ago
Sourav,
You are quite correct in that Active setup would probably be the best way to resolve the initialization of an Excel add-in for all users of a system.
I have been using the code below to add and remove add-in’s for years now. The great thing is that it works without regard to the version of Excel that is installed. These routines utilize the exposed Excel scripting objects to dynamically add the add-in to the user’s registry to the next incremented OPEN key.
The example code is currently set up to be used as msi custom actions. But you can easily adapt it to suit your needs. You will also note, as some others have, that there is no error handling in the examples. This is on purpose as I think people should handle in the manner that they wish and not have to spend time stripping someone else’s error methods from free code.
I hope this helps you
Here is the code for adding an add-in;
On Error Resume Next
Dim oXL : Set oXL = CreateObject("Excel.Application")
Dim oAddin : Set oAddin = oXL.AddIns.Add(session.property("INSTALLDIR") & "ist.xla", True)
oXL.Workbooks.Add
oAddin.Installed = True
oXL.Quit
Set oAddin = Nothing
Set oXL = Nothing
‘*************************************************************************
'Under Install Execute Sequence
'Location: AFTER InstallFinalize
'Condition: NOT REMOVE
'Properties: Immediate Execution; Synchronous; Always Execute
Here is the code for removing and add-in;
On Error Resume Next
Dim oXL : Set oXL = CreateObject("Excel.Application")
Dim oAddin : Set oAddin = oXL.AddIns.Add(session.property("INSTALLDIR") & "ist.xla", False)
oXL.Workbooks.Add
oAddin.Installed = False
oXL.Quit
Set oAddin = Nothing
Set oXL = Nothing
‘******************************************************************
'Under Install Execute Sequence
'Location : AFTER InstallInitialize
'Condition: REMOVE
'Properties: Immediate Execution; Synchronous; Always Execute
‘*************************************************************************
The above code may be altered to either run as an embedded vbscript from within a msi or in the case of multi user or Admin –vs- User installations the scripts can be best triggered via Microsoft Active Setup
You are quite correct in that Active setup would probably be the best way to resolve the initialization of an Excel add-in for all users of a system.
I have been using the code below to add and remove add-in’s for years now. The great thing is that it works without regard to the version of Excel that is installed. These routines utilize the exposed Excel scripting objects to dynamically add the add-in to the user’s registry to the next incremented OPEN key.
The example code is currently set up to be used as msi custom actions. But you can easily adapt it to suit your needs. You will also note, as some others have, that there is no error handling in the examples. This is on purpose as I think people should handle in the manner that they wish and not have to spend time stripping someone else’s error methods from free code.
I hope this helps you
Here is the code for adding an add-in;
On Error Resume Next
Dim oXL : Set oXL = CreateObject("Excel.Application")
Dim oAddin : Set oAddin = oXL.AddIns.Add(session.property("INSTALLDIR") & "ist.xla", True)
oXL.Workbooks.Add
oAddin.Installed = True
oXL.Quit
Set oAddin = Nothing
Set oXL = Nothing
‘*************************************************************************
'Under Install Execute Sequence
'Location: AFTER InstallFinalize
'Condition: NOT REMOVE
'Properties: Immediate Execution; Synchronous; Always Execute
Here is the code for removing and add-in;
On Error Resume Next
Dim oXL : Set oXL = CreateObject("Excel.Application")
Dim oAddin : Set oAddin = oXL.AddIns.Add(session.property("INSTALLDIR") & "ist.xla", False)
oXL.Workbooks.Add
oAddin.Installed = False
oXL.Quit
Set oAddin = Nothing
Set oXL = Nothing
‘******************************************************************
'Under Install Execute Sequence
'Location : AFTER InstallInitialize
'Condition: REMOVE
'Properties: Immediate Execution; Synchronous; Always Execute
‘*************************************************************************
The above code may be altered to either run as an embedded vbscript from within a msi or in the case of multi user or Admin –vs- User installations the scripts can be best triggered via Microsoft Active Setup
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
so that the conversation will remain readable.