Private Sub Workbook_Open()
Dim UN As String, PW As String, response1 As String, response2 As String
UN = "[COLOR="#FF0000"]username[/COLOR]"
PW = "[COLOR="#FF0000"]password[/COLOR]"
response1 = InputBox("Please enter your username.")
If response1 = "" Then
MsgBox ("You have not entered a username.")
ActiveWorkbook.Close False
ElseIf response1 <> UN Then
MsgBox ("Invalid user name.")
ActiveWorkbook.Close False
Else
response2 = InputBox("Please enter your password.")
If response2 = "" Then
MsgBox ("You have not entered a password.")
ActiveWorkbook.Close False
ElseIf response2 <> PW Then
MsgBox ("Invalid password.")
ActiveWorkbook.Close False
Else
MainUF1.Show
End If
End If
End Sub