Windows user name and password for authentication

tsawyer73

New Member
Joined
Mar 20, 2013
Messages
21
I'd like to protect a small area in the excel sheet. Example H45:M47 where the user should put his/her windows username and password as authentication method through a VBA userform window.

I'm not a VBA expert due to that fact the full step by step VBA code and setup will appreciate!

Thanks
 
IF they've already logged into windows - hence you have their username. What use is them typing their password into your spreadsheet again? Windows has already checked who they are - and cytop is right; I suspect that your it department would put the brakes on this one - it may even violate IT policies
 
Upvote 0

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
I wouldn't like to store any username and password just call them from the windows system for the temporarly authentication process.
 
Upvote 0
But what would that actually give you? You already know they are who they say they are since they've already logged into windows.

To get their windows username you can use the environ function - MsgBox environ("username")
 
Upvote 0
as I try to explain to everybody the reason is very simple. I wouldn't like the maintain username/password table but I need to protect some area in the excel sheet. If somebody can give me the solution I'll appreciate that.
Thanks
 
Upvote 0
Then just maintain a list of users who are permitted and check the active user against that list, you can either keep this list on a hidden worksheet and use vlookup or hardcode it into your vba project. If they are in the list they can edit, if they aren't then they can't, simples :)

Assuming a list of usernames in A1-A10

Code:
Function isPermitted() As Boolean


    If UBound(Filter(Application.Transpose(Sheets("MySecretSheet").Range("A1:A10").Value), Environ("username"))) = 0 Then isPermitted = True
    
End Function
 
Upvote 0
Then just maintain a list of users who are permitted and check the active user against that list, you can either keep this list on a hidden worksheet and use vlookup or hardcode it into your vba project. If they are in the list they can edit, if they aren't then they can't, simples :)

Assuming a list of usernames in A1-A10

Code:
Function isPermitted() As Boolean


    If UBound(Filter(Application.Transpose(Sheets("MySecretSheet").Range("A1:A10").Value), Environ("username"))) = 0 Then isPermitted = True
    
End Function


I think that isn't a rigth solution because now the authentication handled by userform and based on this I'd like use username and passwrod through userform graphic interface.
 
Upvote 0
I give up ;) what you're trying to do is complicated and pointless. Since the user has already logged in, why do you need them to log in again? - you already know who they are
 
Upvote 0
I think that isn't a rigth solution because now the authentication handled by userform and based on this I'd like use username and passwrod through userform graphic interface.

I don't see why the userform invalidates that suggestion. Just run the function from the userform.
 
Upvote 0
I don't really know why you need a userform at all, it's better to keep uneccessary ui to a minimum. Just alert them if they can't edit it when they try, otherwise just let them edit away without a userform getting in the way
 
Upvote 0
I give up ;) what you're trying to do is complicated and pointless. Since the user has already logged in, why do you need them to log in again? - you already know who they are
Hello,pls check the file and H45:M47 area. That area protected with VBA script with single password without any username referenced password. I must find the way how can I change that simple method to any username and password related authentication process.(https://docs.google.com/file/d/0B0Jd2YDhu80QUFplb01wcFpDUmc/edit?usp=sharing)
 
Upvote 0

Forum statistics

Threads
1,223,904
Messages
6,175,295
Members
452,631
Latest member
a_potato

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