Link to home
Start Free TrialLog in
Avatar of spar-kle
spar-kleFlag for United Kingdom of Great Britain and Northern Ireland

asked on

A VB macro fails with the error "The requested operation requires elevation." How can I enforce administrator privilege?

I have been using this code for some while.
One of the users has had his PC replaced.
His new PC triggers the following error in Excel:

Run-time error '2157054156 (800702e-4'):
Automation error
The requested operation requires elevation.


When I click the debug button the following code is highlighted
Set OutApp = CreateObject("Outlook.Application")

Please advise
Thanks
Avatar of McKnife
McKnife
Flag of Germany image

"The requested operation requires elevation." - did you follow that advice and elevate?
Right click the script or the program that triggers it and select "run as administrator"
Avatar of spar-kle

ASKER

If I right click the Excel icon and run as administrator, then open the file within the Excel window it seems to work.
But I really need to write this somehow into the VBA, or change the default settings because of the way our systems work.
If it worked before, it could be, that you simply worked as administrator with UAC off - could that be?
Thanks for your reply.
The user has the same access and UAC is off.
I was asking about the old system. UAC was off there, right?
Now, on the new system, it is off, too? and you rebooted after turning it off?

I am not recommending to solve it by turning off UAC, no. find out what your macro is doing that requires elevation. Does it write to protected folders or registry keys? List those, please.
Yes, the UAC was off on the old and the new system. (rebooted too)
The user has local administrator privileges.

It doesn't write to protected folders or keys.

I believe that the elevation is required because the coding writes to an Outlook email.
If Excel isn't opened as Administrator it causes the issue.
Ok, I am not experienced with macro code. You can share it here and I hope that someone else will be able to help you.
Try this.
Open MS Excel
Open the VBA Editor
In the top menu select "Tools - > References"
In the list of "Avaible references" go down an check those who begin with "Microsoft Outlook..."
You can begin with "Microsoft Outlook 14.0 Object Library" if it's unchecked. Back out with OK, to be sure it's loaded, restart MS Excel, then try run your application.
ASKER CERTIFIED SOLUTION
Avatar of spar-kle
spar-kle
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Everything works fine after removing DELL security