compile error in hidden module: Module1

faraz502

Board Regular
Joined
Mar 26, 2014
Messages
127
Office Version
  1. 2016
Platform
  1. Windows
Please check Code

VBA Code:
Option Explicit


Private Sub cmdClear_Click()

    Me.txtUserID.Value = ""
    Me.txtPassword.Value = ""
  
    Me.txtUserID.SetFocus
  
    'Code to exit- Please remove the comments if you want to use it exit
'    Unload Me
'    ThisWorkbook.Close Savechanges:=False
'    Application.Visible = True
  

End Sub

Private Sub cmdLogin_Click()

    Dim user As String
  
    Dim password As String
  
    user = Me.txtUserID.Value
  
    password = Me.txtPassword.Value
  
    If (user = "admin" And password = "MES123") Or (user = "user" And password = "user") Then
  
        Unload Me
        Application.Visible = True
      
    Else
  
        If LoginInstance < 3 Then
      
            MsgBox "Invalid login credentials. Please try again.", vbOKOnly + vbCritical, "Invalid Login Details"
            LoginInstance = LoginInstance + 1
          
        Else
      
            MsgBox "You have exceeded the maximum number of login attempts.", vbOKOnly + vbCritical, "Invalid Credentials"
            Unload Me
            ThisWorkbook.Close Savechanges:=False
            Application.Visible = True
            LoginInstance = 0
          
        End If
  
    End If
  
End Sub



Private Sub cmdLogin_Enter()

End Sub

Private Sub Frame1_Click()

End Sub

Private Sub Image1_BeforeDragOver(ByVal Cancel As MSForms.ReturnBoolean, ByVal Data As MSForms.DataObject, ByVal X As Single, ByVal Y As Single, ByVal DragState As MSForms.fmDragState, ByVal Effect As MSForms.ReturnEffect, ByVal Shift As Integer)

End Sub

Private Sub UserForm_Initialize()

    Me.txtUserID.Value = ""
    Me.txtPassword.Value = ""
  
    Me.txtUserID.SetFocus

End Sub




Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)

    If CloseMode = 0 Then Cancel = True

End Sub
 

Attachments

  • 123.JPG
    123.JPG
    24.7 KB · Views: 12

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
Where is LoginInstance declared?

This appears to all be code for a userform, but the error is in Module1 in a protected VBA Project.
 
Upvote 0
Solution

Forum statistics

Threads
1,214,950
Messages
6,122,436
Members
449,083
Latest member
Ava19

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