Excel Automation Library not working as non-admin

Add-in Express™ Support Service
That's what is more important than anything else

Excel Automation Library not working as non-admin
Excel Automation Library does not work when installed/run as a non-admin user 
Mark K


Guest


Hi,

If our software is installed by a non-admin user the Automation DLL does not work in Excel. If you type in a function name it comes up as '#NAME?' although Excel says that the library is loaded and working fine. If you log in as a admin user, the functions all work perfectly with no changes. The DLL has been compiled using the latest version of Add-In-Express for VCL. RegisterForAllUsers is set to True.

The problem only appears to happen on Vista/Windows 7 operating systems and only if the installing user is not an administrator. The same code/installer works perfectly on XP.

Any help greatly appreciated!

Regards

Mark
Posted 21 Nov, 2010 17:39:00 Top
Mark K


Guest


Further general testing shows that:
1. If you are not an administrator on XP the same thing happens.
2. If you are logged in as either a domain user OR local user (without local admin rights) the same thing happens.
3. Same thing happens for Excel 2003, 2007 and 2010.
4. If you give the user all the local groups eg. Power Users etc, but not Admin, it still doesn't work.


Further testing with Windows 7 just now:

1. We un-installed the add-in
2. We changed NotAdmin to be a local admin
3. Installed the add-in logged in as that NotAdmin account
4. This works (as expected)
5. Removed the Admin rights of the NotAdmin account
6. Logged in as NotAdmin and it still works!!!!

7. Created a NotAdmin2 account which is not an admin locally
8. Logged in as NotAdmin2 ?Â?Ð?ã as expected it doesn?Â?Ð?ét work

9. Logged in as a user which has local admin rights
10. Doesn?Â?Ð?ét work!!!

So it appears that it only works for the user that installed it AND that user has to be a local Admin during install but not necessarily afterwards.

Hope this helps to solve it. Obviously it is a problem for us with XP as well but previous users have had admin rights which doesn't appear to be the case with the new Windows 7 users we are now getting.

Regards

Mark
Posted 22 Nov, 2010 17:58:47 Top
Andrei Smolin


Add-in Express team


Posts: 18825
Joined: 2006-05-11
Hi Mark,

Excel UDFs can be registered on the per-user basis only. That is, your UDF is registered for the only user, the one that installs the add-in. Because RegisterForAllUsers is true, the user must be an administrator. And due to UAC in Windows 7, the user gets administrative privileges only after he/she confirms that action; in other words, a given user logged in to Windows 7 with an administrative account acts as two different users during the same Windows sessions. That is, if the user runs Excel via "Run as administrator" then the UDF works because it was registered for exactly that user. If the user runs Excel bypassing "as administrator" option, the UDF doesn't start.

In short, the workaround is to set RegistrerForAllUsers=False and make your add-in installable by a standard user.


Andrei Smolin
Add-in Express Team Leader
Posted 23 Nov, 2010 03:20:43 Top
Mark K


Guest


Thanks Andrei.

I presume this means that each user will need to install the product to have it registered? To make things easier I presume we could install an item into the start menu group to do the registration for a new user. Alternatively I am thinking that we also install an Excel add in that is not a UDF. Maybe the first thing it could do is check the registration for the UDF module and register it if it is not already registered. What do you think?

Thanks for your assistance with this.

Cheers
Posted 23 Nov, 2010 04:08:02 Top
Andrei Smolin


Add-in Express team


Posts: 18825
Joined: 2006-05-11
Hi Mark,

Yes, the UDF needs to be installed by every user.

Mark K wrote:
What do you think?


The first way looks fine for me. More specifically, you can deploy two add-ins: an all-users COM add-in and a per-user UDF.

The second way (provided that it is doable) leaves the UDF for all other users on the PC when the administrator uninstall the COM add-in.


Andrei Smolin
Add-in Express Team Leader
Posted 23 Nov, 2010 04:39:01 Top
Mark K


Guest


Thanks for all your help Andrei.

I understand the issues now and will be able to sort something out in any case.

Cheers
Posted 23 Nov, 2010 04:52:12 Top
Andrei Smolin


Add-in Express team


Posts: 18825
Joined: 2006-05-11
Good luck!


Andrei Smolin
Add-in Express Team Leader
Posted 23 Nov, 2010 04:55:32 Top
Mark K


Guest


Hi Andrei,

I have altered the RegisterForAllUsers flag as per your suggestion however I am still not able to register the DLL as a standard user. Are there other modifcations I need to make to the code? Alternatively is there another way to register the DLL, or get Excel to use it, without calling REGSVR32?

Thanks and regards

Mark
Posted 23 Nov, 2010 20:39:53 Top
Mark K


Guest


I should have added the message I am getting back when I call REGSVR32 is 'DllRegisterServer in Test.dll failed. Return code was: 0x80004005'. The code means a permissions failure.

Cheers
Posted 23 Nov, 2010 20:52:21 Top
Andrei Smolin


Add-in Express team


Posts: 18825
Joined: 2006-05-11
Hi Mark,

I'm really sorry, it was my fault: you also need to read section "Registering with User Privileges" in {Add-in Express}\Docs\adxvcl.pdf on your PC.


Andrei Smolin
Add-in Express Team Leader
Posted 24 Nov, 2010 10:10:39 Top