albertc30
Well-known Member
- Joined
- May 7, 2012
- Messages
- 1,091
- Office Version
- 2019
- Platform
- Windows
Hi all.
I have a userform that allows me to type in a username and a password.
This then is checked to a hidden sheet and if found it opens if not it returns an error as per bellow code;
This has always worked with no issues and today, it now behaves differently even though that code was never touched.
In fact, when I try to open the spreadsheet again after the error, it now tells me the page is already opened!
In fact, if I enter the wrong password I get the wrong message error!
The error I am now getting is the following;
Run-Time error '1004':
The password you supplied is not correct. Verify that the CAPS LOCK key is off and be sure to use the correct capitalization.
Also, with a top spec PC i5 with 16GB RAM why is VBA telling me no memory or low memory?
It's all happening at once.
Any help is really appreciated.
Thanks.
I have a userform that allows me to type in a username and a password.
This then is checked to a hidden sheet and if found it opens if not it returns an error as per bellow code;
Code:
Private Sub cmBtnLogin_Click()
Dim iFoundPass As Integer
On Error Resume Next
With Sheets("UsersHide").Range("UserNames")
iFoundPass = .Find(What:=txtBoxUserName, After:=.Cells(1, 1), LookIn:=xlValues, LookAt _
:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False).Row
End With
On Error GoTo 0
If iFoundPass = 0 Then
SomethingWrong
Exit Sub
End If
If Sheets("UsersHide").Cells(iFoundPass, 2) <> txtBoxPassword Then
SomethingWrong
Exit Sub
End If
Sheets("Invoice").Unprotect Password:="******"
Sheets("Invoice").Range("CurrentUser") = txtBoxUserName
Sheets("Invoice").Protect Password:="*******"
Unload Me
Application.Visible = True
End Sub
This has always worked with no issues and today, it now behaves differently even though that code was never touched.
In fact, when I try to open the spreadsheet again after the error, it now tells me the page is already opened!
In fact, if I enter the wrong password I get the wrong message error!
The error I am now getting is the following;
Run-Time error '1004':
The password you supplied is not correct. Verify that the CAPS LOCK key is off and be sure to use the correct capitalization.
Also, with a top spec PC i5 with 16GB RAM why is VBA telling me no memory or low memory?
It's all happening at once.
Any help is really appreciated.
Thanks.