Private Sub Workbook_BeforeClose(Cancel As Boolean)
If ThisWorkbook.ReadOnly = True Then
If MsgBox("Ce classeur est ouvert en lecture seule et ne peut pas être enregistrer." & Chr(13) & _
"Toutes les modifications seront perdues.", _
vbExclamation + vbOK, "Attention") = vbOK Then
If [U]Application.ThisWorkbook.Saved = False[/U] Then
Else
End If
End If
End If
For Each sh In Sheets
sh.Protect Password:="Mot de passe"
Next sh
ThisWorkbook.Save
End Sub