Option Explicit
Private Declare PtrSafe Function GetSystemMenu Lib "User32" (ByVal hWnd As Long, ByVal bRevert As Long) As Long
Private Declare PtrSafe Function DeleteMenu Lib "User32" (ByVal hMenu As Long, ByVal nPosition As Long, ByVal wFlags As Long) As Long
Private Declare PtrSafe Function FindWindowA Lib "User32" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Public Sub Desactive_Croix()
Dim Retour_Val As Long
On Error Resume Next
Retour_Val = FindWindowA(vbNullString, Application.Caption)
If Retour_Val <> 0 Then
'désactive la croix de fermeture d'Excel et la commande Fermeture du menu système
DeleteMenu GetSystemMenu(Retour_Val, False), 6, &H400
End If
End Sub
Public Sub Active_Croix()
Dim Retour_Val As Long
On Error Resume Next
'rétablit la croix de fermeture d'Excel et la commande Fermeture du menu système
Retour_Val = FindWindowA(vbNullString, Application.Caption)
GetSystemMenu Retour_Val, True
End Sub