You are not authorize to use this macro.

Niteshnitesh

New Member
Joined
Nov 9, 2017
Messages
21
Hi all,

I have macro that I want to share with ten people in my team. I have doubt that they can share this macro with another team. I have a excel file in which from A1: A10 are username of ten employees.This file is located in share drive /F:/Temp files/Book1.xlsx. Every one can access this file.I need a code that validate if username exist in that file then it run, if not it give error "You don't have access to use this macro." That file is password protected.
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
you can lock the sheet for editing with a password and only give the password to the 10 people you want to run the macro. you can also password protect the entire workbook then only the ones with a password can even open it to see it. two different password one for the workbook and one for the sheet(s)


Might be easier than VBA
 
Upvote 0
You could put something like this at the top of your macro:

Code:
    ValidNames = Array("Huey", "Dewey", "Louie", "Daisy")
    
    If InStr("," & LCase(Join(ValidNames, ",")) & ",", "," & LCase(Application.UserName) & ",") = 0 Then
        MsgBox "Not allowed"
        Exit Sub
    End If
 
Upvote 0

Forum statistics

Threads
1,223,885
Messages
6,175,179
Members
452,615
Latest member
bogeys2birdies

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