Stop the Debug option from coming up
The code you have posted shouldn't cause the debug option window to pop up so
it must be some other part of the code after the endif so try this small
change:-
Sub Sonic()
Dim MyStr1 As String, MyStr2 As String
MyStr2 = ("admin") 'This is the password and it is CASE sensitive
MyStr1 = InputBox("Password Required")
If MyStr1 = MyStr2 Then
ActiveSheet.Unprotect Password:=MyStr1
Else
MsgBox ("Access Denied")
Exit Sub
End If
End Sub
Mike
"sus1e" wrote:
I have a code which asks the user to input a password before it will continue
with the code. If the password is incorrect it puts up a message box which
informs the user. At this point, I get the microsoft error message which
gives the user the option to debug............ I don't want this to occur.
Is there any way I can stop the microsoft error message from coming up?
My current code looks like:
Dim MyStr1 As String, MyStr2 As String
MyStr2 = ("admin") 'This is the password and it is CASE sensitive
MyStr1 = InputBox("Password Required")
If MyStr1 = MyStr2 Then
ActiveSheet.Unprotect Password:=MyStr1
Else
MsgBox ("Access Denied")
End If
Rest of code.....................
Thanks in advance.
|