tomy7
Messages postés62Date d'inscriptionmardi 22 janvier 2008StatutMembreDernière intervention25 avril 2008
-
4 févr. 2008 à 11:40
cs_MPi
Messages postés3877Date d'inscriptionmardi 19 mars 2002StatutMembreDernière intervention17 août 2018
-
4 févr. 2008 à 23:47
bonjour je developpe un outils sous excel2003 et je cherche a verrouiller l enregistrement a l aide d un mot de passe est ce que quelqu un a une idee a ce sujet!!!
merci d avance
tomy7
Messages postés62Date d'inscriptionmardi 22 janvier 2008StatutMembreDernière intervention25 avril 2008 4 févr. 2008 à 14:05
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Password = InputBox("Enter the password:", "Private access")If Password "niania" Then Cancel False _
Else cancel = true
msg = " You don't have the right!"
ans = MsgBox(msg, vbOK)
End Sub
tomy7
Messages postés62Date d'inscriptionmardi 22 janvier 2008StatutMembreDernière intervention25 avril 2008 4 févr. 2008 à 13:25
j ai trouve le code mais j ai un souci au niveau de la inputbox:
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Cancel = True
Password = InputBox("Enter the password:", "Private access")If Password "niania" Then Cancel False
" ici je ne sais pas comment ecrire If password = " quelque chose d autre" then
msg = " You don't have the right!"
ans = MsgBox(msg, vbOK)
End Sub
cs_MPi
Messages postés3877Date d'inscriptionmardi 19 mars 2002StatutMembreDernière intervention17 août 201823 4 févr. 2008 à 23:47
Tu pourrais simplifier un peu en utilisant <> au lieu de =
Password = InputBox("Enter the password:", "Private access")
If Password <> "niania" Then
Cancel = true
MsgBox(" You don't have the right!", vbOK)
End If
MPi²
Pour ceux qui programment sous Office, n'oubliez pas qu'il existe un forum dédié à ces applications VBA....... ICI