Celle d'Excel (X blanc dans un carré rouge).
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionOption Explicit 'Comment peut on desactiver les 3 icones (réduire, restaurer,fermer) ainsi 'que l'icone en haut à gauche d'une application excel afin d'empêcher 'l'utilisateur de fermer Excel autrement que par un bouton prévu à cet effet ? '(Laurent Longre) Private Declare Function FindWindowA Lib "User32" _ (ByVal lpClassName As String, ByVal lpWindowName As String) As Long Private Declare Function GetWindowLongA Lib "User32" _ (ByVal hwnd As Long, ByVal nIndex As Long) As Long Private Declare Function SetWindowLongA Lib "User32" _ (ByVal hwnd As Long, ByVal nIndex As Long, _ ByVal dwNewLong As Long) As Long Private Sub CommandButton1_Click() 'pour désactiver Dim hwnd As Long hwnd = FindWindowA(vbNullString, Application.Caption) SetWindowLongA hwnd, -16, GetWindowLongA(hwnd, -16) And &HFFF7FFFF End Sub Private Sub CommandButton2_Click() 'pour remettre dans l'état initial Dim hwnd As Long hwnd = FindWindowA(vbNullString, Application.Caption) SetWindowLongA hwnd, -16, GetWindowLongA(hwnd, -16) Or &H80000 End Sub