Run Excel as administrator from code, or prompt for elevated UAC permissions

dlgknight

New Member
Joined
Mar 31, 2011
Messages
1
Greetings all,
I need a little assistance. Some background -
I'm working with a split 2007 access database, with a network back end and a run-time front end 'installed' on each users computer. There are up to 300 people using this system at any given time. To facilitate updates to the front end I've written a simple vba project in excel to delete the old front end file from the users program files and copy in the new one that is available on the network. This excel workbook gets called, and the access file closed, from access when a new version is available.

Now, where I'm running into trouble. This process works fine on XP. However, if the UAC on Windows 7 is not turned off, it blocks access to do basically anything to the files stored in Program Files, so I get an error when it tries to delete the old file. I had been just lowering the UAC on the windows 7 computers in the office, but for other reasons i can't leave the UAC lowered.

If I run Excel as administrator first and then open the workbook, it works fine.

So my question - is it possible from VBA to run excel as administrator? I've found code to do this in vb.net, but not from vba.

Or, is it possible to request elevated UAC permissions through vba? Again, I can do it in .net, but haven't found a reference for vba.

Or, does anyone have a better suggestion as to handle the situation.

Thanks!
David
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.

Forum statistics

Threads
1,224,566
Messages
6,179,550
Members
452,927
Latest member
rows and columns

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top