Heap of Pinto Beans
Heap of Pinto Beans

Reputation: 677

VBA code to run as a different network user

Is it possible for me to run VBA code as a different user, thereby preventing the user from directly renaming \ deleting certain files and folders, but allowing the program to run as a different user that is allowed to rename \ delete certain files and folders.

Upvotes: 1

Views: 2411

Answers (1)

Heap of Pinto Beans
Heap of Pinto Beans

Reputation: 677

I created a batch file that has this code in it. I have my authorized excel users double click on this batch file. I give them the password. The account is a service account, so it doesn't have any log in priviledges.

It works! This way, I remove my user base from directly having access to certain files and folders. They have to let the macros to the file manipulation....

My Batch File:

runas /user:ALLIEDFIT\kmistry /savecred "C:\Program Files (x86)\Microsoft Office\Office15\Excel.exe \"S:\Allied MTRS\Allied MTRS Auto\Awaji_Auto\_Prod_Push.xlsm\""

Upvotes: 5

Related Questions