Private Sub Workbook_Open()
Dim pw As String
Application.DisplayAlerts = False
Worksheets.Add
pw = InputBox("Please enter password")
If Not pw = "abcd" Then
MsgBox "You have entered an incorrect password" & _
vbNewLine & vbNewLine & "This workbook will now close."
ActiveSheet.Delete
ThisWorkbook.Close
Exit Sub
End If
ActiveSheet.Delete
Application.DisplayAlerts = True
End Sub