How to register library/reference from vba code?

Do you say that it is enough to run regasm.exe on a batch file even without logging in as admin?
RegAsm? Did I miss something? Up until now we were discussing RegSvr32 to register the COM server.
By default RegSvr32 will only register the library at system level (DllRegisterServer) which requires admin permissions. However, if your DLL supports user level installation in its DllInstall function, it can be registered with RegSvr32 by passing the appropriate command line switch.

Independently of RegSvr32 (and RegAsm), you can also write the required Registry settings for the DLL using either a .reg file, a batch script or even VBA. This definitely works without admin permissions when just writing to HKCU for the current user.
 
RegAsm /regfile:filename.reg => reg file for HKLM => change HKLM to HKCU.
 
I wrote regasm.exe because in my case, they are libraries created as dot-net assemblies, with c# language
This is of fundamental importance. You should have included this information in your very first post because people gave you a lot of very good advice which, as it turns out only now, is not really applicable in your case.
 
This is of fundamental importance. You should have included this information in your very first post because people gave you a lot of very good advice which, as it turns out only now, is not really applicable in your case.

You are right
 
These are libraries I created, not the standard ones provided with Access or already present in Windows

My confusion remains. In order to have the file be usable, if YOU created it, how do you not know where it is and what it is? This library didn't get to a usable location via telepathy or time-travel. Someone put it somewhere and, since you created it, how is that someone not you?
 
add to Attachment your COM library.
add also a command file (Register.cmd):
Code:
@ECHO OFF

reg Query "HKLM\Hardware\Description\System\CentralProcessor\0" | find /i "x86" > NUL && set OS=32BIT || set OS=64BIT

"%SystemRoot%\Microsoft.NET\Framework\v4.0.30319\regasm.exe" /unregister %~dp0MySocketConnector.dll
"%SystemRoot%\Microsoft.NET\Framework\v4.0.30319\regasm.exe" /codebase %~dp0MySocketConnector.dll /tlb %~dp0MySocketConnector.tlb

if %OS%==64BIT "%SystemRoot%\Microsoft.NET\Framework64\v4.0.30319\regasm.exe" /unregister %~dp0MySocketConnector.dll
if %OS%==64BIT "%SystemRoot%\Microsoft.NET\Framework64\v4.0.30319\regasm.exe" /codebase %~dp0MySocketConnector.dll /tlb %~dp0MySocketConnector.tlb

Extract both MySocketConnector.dll and Register.cmd on same folder and run Register.cmd using Shell command.
 
My confusion remains. In order to have the file be usable, if YOU created it, how do you not know where it is and what it is? This library didn't get to a usable location via telepathy or time-travel. Someone put it somewhere and, since you created it, how is that someone not you?

The PEPPE.ACCDE program was initially created without the use of external libraries
In later versions, the PEPPE.ACCDE program began using external libraries
A user attempting to use the latest versions of PEPPE.ACCDE without placing the external libraries in the correct location and registering them so the operating system knows about them would be unable to run the program correctly
And the code couldn't provide any useful information other than the fact that something is missing
But what is missing? The code doesn't know
At least until it is provided with a correspondence between the GUID and the library
This last thing, although simple, was missing
 

Users who are viewing this thread

Back
Top Bottom