runtime error 6..

paran

New Member
Joined
Aug 23, 2021
Messages
32
Office Version
  1. 365
Platform
  1. Windows
hi, while entering the code i get error "runtime error 6.., pls help as I'm new to vba

Private Sub Label8_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
Dim MyPass As Long
MyPass = InputBox("Enter Developer Password", "Developer Setting")
If MyPass = "" Then GoTo WrongDPass
If MyPass = CStr(Sheets("in moves").Range("B101")) Then
Application.Visible = True
Unload Me
Else
MsgBox ("Incorrect Password")
End If
WrongDPass:
End Sub
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
Are you entering a very long number as the password?
 
Upvote 0
I think you should change Declare type for MyPass.
Try to change it to Double, String or Variant and then test your code.
Or Add Type:= at the end of Inputbox options.
1 for Number, 2 for string, 64 for variant. for example
VBA Code:
InputBox("Enter Developer Password", "Developer Setting", Type:=1)
 
Upvote 0
I think you should change Declare type for MyPass.
Try to change it to Double, String or Variant and then test your code.
Or Add Type:= at the end of Inputbox options.
1 for Number, 2 for string, 64 for variant. for example
VBA Code:
InputBox("Enter Developer Password", "Developer Setting", Type:=1)
thx for ur reply,adding type comming error of name argument
but worked with declaring variable as double ,fails when password is ety its returning error
 
Upvote 0
Declare it as String since passwords are always text.
 
Upvote 0
Declare it as String since passwords are always text.
wow great now done bro

ok dear will ck and revert
done ,great bro
one more same error " password incorrect"
Private Sub Image5_Click()
Dim p As String
p = Sheets("in moves").Range("B100")
UserID = StrConv(Me.TextBox1, vbProperCase)
If Sheets("in moves").Range("A100") = UserID And CStr(Sheets("in moves").Range("B100")) = Me.TextBox2 Then
Unload Me
MvmtForm.Show
Else
MsgBox ("Please enter your Correct User Id and Password")
Me.TextBox1 = ""
Me.TextBox2 = ""
Me.TextBox1.SetFocus
End If
End Sub
 
Upvote 0
That's not a code error, it just means that either your password or userid doesn't match. Both tests are case sensitive.
 
Upvote 0
That's not a code error, it just means that either your password or userid doesn't match. Both tests are case sensitive.
Its user id in a100 n password in b100. Pls say how to make it right code pls
 
Upvote 0
As I said the code is fine. If you’re seeing that message, then the user ID and/or password you entered do not match.
 
Upvote 0
Solution

Forum statistics

Threads
1,215,442
Messages
6,124,886
Members
449,194
Latest member
ronnyf85

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