Hello Members,
Below is the detail of my idea that I want to accomplish:
I have created an excel with number of macros that will be used by different users across the organization. These users needs to be granted permissions (Read Only, Read Write, Full Access etc.) and updated in a sheet names "Access Sheet" of this same excel.
What I want to achieve is that when a user tries to run a macro, based on the users access level assigned in the "Access Sheet" the macro should either run or displays a message of access denied and macro exits.
How I want to achieve this:
1. When a user hits a button to run the macro, the script will run and get the username (using UserName = Environ$("UserName") command.
2. code then compares this system username against the usernames updated in the "Access Sheet" and lookup the access level granted to the user in that "Access Sheet".
3. if the retrieved username does not exists in the "Access Sheet" OR the Access Level Granted is "Read Only", then the code should stop execution after displaying the "ACCESS DENIED" message.
Can anyone provide me with a code for the same. Thanks a lot in advance.
Below is the detail of my idea that I want to accomplish:
I have created an excel with number of macros that will be used by different users across the organization. These users needs to be granted permissions (Read Only, Read Write, Full Access etc.) and updated in a sheet names "Access Sheet" of this same excel.
What I want to achieve is that when a user tries to run a macro, based on the users access level assigned in the "Access Sheet" the macro should either run or displays a message of access denied and macro exits.
How I want to achieve this:
1. When a user hits a button to run the macro, the script will run and get the username (using UserName = Environ$("UserName") command.
2. code then compares this system username against the usernames updated in the "Access Sheet" and lookup the access level granted to the user in that "Access Sheet".
3. if the retrieved username does not exists in the "Access Sheet" OR the Access Level Granted is "Read Only", then the code should stop execution after displaying the "ACCESS DENIED" message.
Can anyone provide me with a code for the same. Thanks a lot in advance.