LogIn User Form Code

Willmonbo

Board Regular
Joined
May 16, 2010
Messages
141
I am in need of a login user form that requires a username and password to use the file, the poor protection this method offers not withstanding, I found code that seems to work (the link is below) but the only problem i'm having with it is that even when the correct login information is entered I still get a warning message before it proceeds to complete the login, I'd greatly appreciate someone taking a look at the code and shed some light on this for me.

thanks in advance.


http://www.ozgrid.com/forum/showthread.php?t=31194&highlight=password/user+attempt+count
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
I don't know if it's the cause of your problem, but you need And instead of Or here:

Rich (BB code):
If txtuser.Text <> "Peter Arnett" Or txtpassword.Text <> "Alison" Then
 
Upvote 0
Andrew, thanks for taking time to look at this, I do have my code saying "or", but I changed it to "and" and it didn't do anything different, so that's not really it, any other ideas?

my code comes directly from the attached excel file in that thread.
 
Last edited:
Upvote 0
I should add that I figured out a go around but am still curious if there is simple way to avoid this, what I did is it has another sub routine with the following code (see below), this should prevent the user from canceling the user form with the top right corner "x" but I deleted the last line that had the msg since it was triggered even after being closed with the correct login information.


Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
If CloseMode = 0 Then Cancel = True
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,848
Members
452,361
Latest member
d3ad3y3

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