![]() |
||||
This article explains the Windows Registry entries required to register an add-in created with the .NET Framework for the VBA editor of Microsoft Office for the current user without requiring admin rights. More informationThe VBA editor of Microsoft Office supports COM-based add-ins, so to register a dll as an add-in for such host two registrations are required:
1. Registration as add-in for the VBA editor To register an add-in for the VBA editor of Microsoft Office, a registry key with the ProgId of the Connect class of the add-in used in the COM registration (for example, "MyVBAAddIn.Connect") must be created under the following registry key:
Important: Notice that add-ins are registered for the current user (using the HKEY_CURRENT_USER hive), not for all users (the HKEY_LOCAL_MACHINE hive is ignored by the VBA editor when looking for add-ins). This means that a setup can not install an add-in for all the users of the machine. Under the registry key with the ProgId, the following values must be created:
So, for Microsoft Office 32-bit the registry entries would be:
HKEY_CURRENT_USER\Software\Microsoft\VBA\VBE\6.0\Addins\MyVBAAddin.Connect FriendlyName = My VBA Add-in Description = My VBA Add-in description LoadBehavior = 3 And for Microsoft Office 64-bit the registry entries would be:
HKEY_CURRENT_USER\Software\Microsoft\VBA\VBE\6.0\Addins64\MyVBAAddin.Connect FriendlyName = My VBA Add-in Description = My VBA Add-in description LoadBehavior = 3 2. Registration as COM component COM-registration is normally achieved with some tool like regsrv32.exe for COM-dlls and regasm.exe for .NET dlls registered for COM Interop. These tools require admin rights because they write registry entries in the HKEY_LOCAL_MACHINE (to register the COM component to all the users of the machine). However, since the registration of the dll as add-in for the VBA editor can be done only for the current user, performing COM registration only for the current user (and not for all users) brings these two advantages:
To register a .NET dll as COM component for the current user (without requiring admin rights), some registry entries must be created for each class of the dll that must be registered (the Connect class, and the classes of userdocuments/usercontrols hosted in toolwindows). Those classes must be Public and have the System.Runtime.InteropServices.ComVisible(True) attribute (see the article HOWTO: Create a toolwindow for the VBA editor of Office from an add-in with Visual Studio .NET.). For each class the following data is required:
Given, for example, the following values for the Connect class:
Then the registry entries would be the following:
HKEY_CURRENT_USER\Software\Classes\MyVBAAddin.Connect
(default) = MyVBAAddin.Connect
HKEY_CURRENT_USER\Software\Classes\MyVBAAddin.Connect\CLSID
(default) = {2CA1C920-2D5E-3E17-86D7-24DEB9303A3E}
HKEY_CURRENT_USER\Software\Classes\CLSID\{2CA1C920-2D5E-3E17-86D7-24DEB9303A3E}
(default) = MyVBAAddin.Connect
HKEY_CURRENT_USER\Software\Classes\CLSID\{2CA1C920-2D5E-3E17-86D7-24DEB9303A3E}\InProcServer32
(default) = mscoree.dll
Assembly = MyVBAAddin, Version=1.0.0.0, Culture=neutral, PublicKeyToken=869cad219d7a35e2
Class = MyVBAAddin.Connect
Codebase = file:///<path>/MyVBAAddin.DLL
RuntimeVersion = v2.0.50727
ThreadingModel = Both
HKEY_CURRENT_USER\Software\Classes\CLSID\{2CA1C920-2D5E-3E17-86D7-24DEB9303A3E}\ProgId
(default) = MyVBAAddin.Connect
Related articles
|
| Copyright © 2000-2013 MZTools Software. All Rights Reserved. Legal Notice |