Hello,

I have 2 profil Outlook, and i want one password for the first profile and another password for the 2nd profile when i open Outlook.
I have this code but it's incorrect... Can you help me ?

Private Sub Application_Startup()
Dim i As Integer
Dim pass As String
Dim chaine As String
Dim chaine2 As String
i = 0
chaine = "toto"
chaine2 = "toto2"

Dim myNamespace As Outlook.NameSpace
Dim myNamespace2 As Outlook.NameSpace
Set myNamespace = Application.GetNamespace("Outlook")
Set myNamespace2 = Application.GetNamespace("mairiepln")

If myNamespace Then

While i < 3 And pass <> chaine
pass = InputBoxDK("saisissez le mot de passe")
i = i + 1

If i = 1 And pass <> chaine Then
MsgBox ("Mot de passe inccorect")
End If

If i = 2 And pass <> chaine Then
MsgBox ("Mot de passe inccorect")
End If

If i = 3 And pass <> chaine Then
MsgBox ("Mot de passe inccorect")
Application.Quit
End If
Wend

End If

If myNamespace2 Then

While i < 3 And pass <> chaine2

pass = InputBoxDK("saisissez le mot de passe")
i = i + 1

If i = 1 And pass <> chaine2 Then
MsgBox ("Password incorect")
End If

If i = 2 And pass <> chaine2 Then
MsgBox ("Password incorect")
End If

If i = 3 And pass <> chaine2 Then
MsgBox ("Password incorect")
Application.Quit
End If
Wend

End If

End Sub