You are on page 1of 1

Code to activate workbook

Private Sub Workbook_Activate()


Application.Visible = False
UserForm.Show
End Sub

Code for Login


Private Sub cmdLogin_Click()
If txtName.Text = "Admin" And txtPassword.Text = "Password" Then
MsgBox "You have unlock the file successfully"
Application.Visible = True
Unload Me
Else
MsgBox "Please enter correct Username and Password"
txtName = ""
txtPassword = ""
End If
End Sub

Dim heure As String


Dim message As String
Dim alerte As Double

Sub Alerte_Message()
On Error Resume Next
If Date + TimeValue(Now) <> alerte Then
heure = Application.InputBox("à quelle heure voulez-vous activer le rappel..?",
"hh:mm")
If heure <> "" Then
message = InputBox("quel est le message à afficher...?", "alerte")
alerte = Date + TimeValue(heure)
Application.OnTime alerte, "Alerte_message"
End If
Else
Beep
Application.Speech.Speak message
MsgBox message
message = ""
alerte = 0
End If
End Sub

You might also like