COM Interop without regasm COM Interop without regasm vba vba

COM Interop without regasm


I solved this by running regasm with the /regfile option, and replacing HKLM with HKCU in the resulting .reg file.


There's RegistrationServices.RegisterAssembly .NET API (which I believe is used by RegAsm.exe).

There's also RegOverridePredefKey Win32 API, inconspicuous but quite useful, which allows to remap HKEY_CLASSES_ROOT (used by RegisterAssembly) to HKEY_CURRENT_USER\Software\Classes.

A clever program can use both RegistrationServices.RegisterAssembly and RegOverridePredefKey to register an assembly for COM clients under HKEY_CURRENT_USER.

I haven't tried this myself, but I believe it's quite doable.

Updated, apparently this approach does works.


Registering a COM object (ex. ActiveX control) and making it visible to all users in the system requires administrative rights.

BUT, if visibility to all users is not needed (or not possible due to limited user restriction) then the COM object can be registered only for the particular user.

This generally done by registering the object in HKCU instead of HKLM. This will apply for "regular" COM objects and the ones exposed through .NET COM Interop.

Other more fine grained approaches also exits, the already mentioned RegFree COM which addresses a particular executable.

So, given all of the above the solution to capture all info into reg file and replace HKLM with HKCU shall work (not nice, but so are the tools).