Windows 10 and Run As Administrator

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

Windows 10 and Run As Administrator
Excel COM AddIn will not AddIn.Connect unless Excel is started As Administrator 
Jarid Griesel


Guest


Our Excel COM Addin would load fine on Windows 7 and Windows 8.1 without starting Excel "As Administrator".

Under Windows 10 Pro / Ent, the loading of the COM Addin will fail on the AddIn.Connect command in VBA if Excel is started normally even though the logged in user belongs to the Windows "Administrators" Group and the shortcut for Excel on the Windows Start menu is set to "Run as Administrator".

The only way that I can get the AddIn.Connect command in VBA to succeed ( and to display the task pane) is to Right Mouse on the Excel Shortcut and select "Run As Administrator".

We are also using Visual Studio 2015, Office Pro 2016 and Add-in Express 8 on Windows 10 Enterprise 64bit

The COM addin was registered from within Visual Studio 2015 using the Add-In Express > Register menu option.
This situation is happening on two sepperate development computers running the same software setup.


1) Is this the correct behaviour of Excel loading COM Addins on Windows 10 ?
2) Is there anyway to get Excel to load the COM Addin without first having to select the Excel Shortcut and then select "Run As Administrator" ?
Posted 26 Oct, 2015 09:10:42 Top
Andrei Smolin


Add-in Express team


Posts: 18821
Joined: 2006-05-11
Hello Glen,

I cannot answer your questions right off my head; I need to understand what's going on first.

Jarid Griesel writes:
the COM Addin will fail on the AddIn.Connect command in VBA


What error message are you getting? Is the VBA code executed in Excel or in some other Office application? Is the add-in per-machine or per-user?

Jarid Griesel writes:
if Excel is started normally even though ... the shortcut for Excel on the Windows Start menu is set to "Run as Administrator".


Please clarify whether Excel is started normally or via the "Run as administrator" command.


Andrei Smolin
Add-in Express Team Leader
Posted 27 Oct, 2015 04:44:19 Top
Glen Griesel


Guest


We have created an Excel Task Pane Add-In that loads perfectly on Windows 7 and 8.1 in Office 2103 and Add-in Express 7. The add-in is set to load on demand.


However, on Windows 10, the Task Pane Add-In will only load if Excel is started with elevated / administrator privileges (ie Right Mouse Click > "Run As Administrator")
If Excel is started with normal privledges on Windows 10, the Add-in does not load.
This behaviour happens no matter wether the Add-in is registered as a Per-User Add-in or as a All-Users Add-in.
In all cases (Windows 7 or 8.1 or 10) the user logs into Windows as a member of the "Local Administrators" group.

The Excel VBA code that loads the add-in is as follows:


LineNo	VBA Code
------	--------
01      ' get the reference to the com add-in using it's ProgId property
02      Set poAddIn = Application.COMAddIns.Item("MyCOMAddin.AddinModule")
03      ' record a reference to the addin object
04      Set poAIObj = poAddIn.Object
05      '*> the addin is set to loadondemand, so on accessing it for the 1st
06      '*> time, the addin object will be nothing
07      If poAIObj Is Nothing Then
08        '*> so we need to get the addin to connect
09        poAddIn.Connect = True
10        '*> and re try the addin object
11        Set poAIObj = poAddIn.Object
12      End If
13      If Not poAIObj Is Nothing Then
14        '*> the addin is connected
15        Call poAIObj.Show("s")
16      Else
17        MsgBox "The " + lcTx2 + " AddIn could not be connected or " & _
18        "activated. ", vbCritical, "AddIn Connection Error"
19      End If


1) Excel is started with normal privileges
******************************************
poAddIn.Object in Line No 11 returns Nothing. This is because poAddIn.Connect = True in line 09 did
not execute as intended and the Add-in was not loaded (most likely due to insufficient privilges).
Note that in this case Excel VBA did not post any messages or error states.
Here the loading of the Add-in fails.

2) Excel is started with elevated / administrator privileges
************************************************************
poAddIn.Object in Line No 11 returns a valid object reference to the MyCOMAddin.AddinModule object.
This is because poAddIn.Connect = True in line 09 worked effectively.
Here the loading of the Add-in succeeds


My Question is:
***************
What can be done to get poAddIn.Connect = True in line 09 to work effectively when Excel is run with normal privileges ?
Posted 27 Oct, 2015 07:43:21 Top
Andrei Smolin


Add-in Express team


Posts: 18821
Joined: 2006-05-11
Glen,

Glen Griesel writes:
What can be done to get poAddIn.Connect = True in line 09 to work effectively when Excel is run with normal privileges ?


I don't know yet.

Glen Griesel writes:
poAddIn.Connect = True


Does executing this line create/update adxloader.log?

Glen Griesel writes:
poAddIn.Object in Line No 11 returns a valid object reference to the MyCOMAddin.AddinModule object.


Is poAIObj declared as Object in your VBA code?


Andrei Smolin
Add-in Express Team Leader
Posted 27 Oct, 2015 11:07:49 Top
Glen Griesel


Guest


Hi Andrei

1) When Excel is started with normal privileges, the code in line 09, poAddIn.Connect = True, does NOT create or update adxloader.log

When Excel is started with administrator privileges, the code in line 09, poAddIn.Connect = True, does create and update adxloader.log


2) In Excel VBA, poAIObj is declared as Object and poAddIn is declared as Office.COMAddIn
Posted 27 Oct, 2015 11:31:54 Top
Andrei Smolin


Add-in Express team


Posts: 18821
Joined: 2006-05-11
Glen Griesel writes:
1) When Excel is started with normal privileges, the code in line 09, poAddIn.Connect = True, does NOT create or update adxloader.log


Does this produce an error? What is Err.Description?


Andrei Smolin
Add-in Express Team Leader
Posted 27 Oct, 2015 11:39:04 Top
Glen Griesel


Guest


After the code in line 09, poAddIn.Connect = True, has executed Excel VBA does not raise any messages.

However after executing line 09, Err contains the following:
Err.Number = -2147467259
Err.Description = This add-in is installed for all users on this computer and can only be connected or disconnected by an administrator.

1) Err.Number and Err.Description are the same no matter whether Add-in Express 8 has registered the add-in as a Per-User Add-in (RegisterForAllUsers = False) or as a Per-Machine Add-in (RegisterForAllUsers = True).
2) The user account used to log into Windows is a member of the local "Administrators" Group.
3) This problem is happening on the development machine, that is the one with Visual Studio 2015 and Add-in Express 8 installed.
Posted 27 Oct, 2015 12:25:21 Top
Andrei Smolin


Add-in Express team


Posts: 18821
Joined: 2006-05-11
Glen Griesel writes:
Err.Description = This add-in is installed for all users on this computer and can only be connected or disconnected by an administrator.


That is, elevated privileges are required to perform this operation on a per-machine add-in; you cannot perform this action unless you start Excel via the "Run as administrator" command.

Consider using a per-user add-in, not per-machine.


Andrei Smolin
Add-in Express Team Leader
Posted 28 Oct, 2015 06:02:49 Top
Glen Griesel


Guest


It makes no difference whether the Add-In is registered as per-machine or per-user.

Err.Description is the same whether the Add-In is registered as per-machine or per-user
Posted 28 Oct, 2015 06:44:46 Top
Andrei Smolin


Add-in Express team


Posts: 18821
Joined: 2006-05-11
Glen,

The error message specifically points to a per-machine add-in. I suppose your add-in is registered both per-machine and per-user; unregister it and check that you have no traces of it in the registry. Then register it per-user; make sure the registration process is run non-elevated.


Andrei Smolin
Add-in Express Team Leader
Posted 28 Oct, 2015 06:48:40 Top