Bonjour
Il faur ajouter dans le code lié au classeur (Module ThisWorkbook) la
procédure suivante :
Private Sub Workbook_SheetBeforeRightClick(ByVal Sh As Object, ByVal
Target As Range, Cancel As Boolean)
Cancel = True
End Sub
PN
www.exefac.com
Bonjour
Il faur ajouter dans le code lié au classeur (Module ThisWorkbook) la
procédure suivante :
Private Sub Workbook_SheetBeforeRightClick(ByVal Sh As Object, ByVal
Target As Range, Cancel As Boolean)
Cancel = True
End Sub
PN
www.exefac.com
Bonjour
Il faur ajouter dans le code lié au classeur (Module ThisWorkbook) la
procédure suivante :
Private Sub Workbook_SheetBeforeRightClick(ByVal Sh As Object, ByVal
Target As Range, Cancel As Boolean)
Cancel = True
End Sub
PN
www.exefac.com
Bonjour
Il faur ajouter dans le code lié au classeur (Module ThisWorkbook) la
procédure suivante :
Private Sub Workbook_SheetBeforeRightClick(ByVal Sh As Object, ByVal
Target As Range, Cancel As Boolean)
Cancel = True
End Sub
PN
www.exefac.com
Bonjour
Il faur ajouter dans le code lié au classeur (Module ThisWorkbook) la
procédure suivante :
Private Sub Workbook_SheetBeforeRightClick(ByVal Sh As Object, ByVal
Target As Range, Cancel As Boolean)
Cancel = True
End Sub
PN
www.exefac.com
Bonjour
Il faur ajouter dans le code lié au classeur (Module ThisWorkbook) la
procédure suivante :
Private Sub Workbook_SheetBeforeRightClick(ByVal Sh As Object, ByVal
Target As Range, Cancel As Boolean)
Cancel = True
End Sub
PN
www.exefac.com
Bonjour Patrice,
Le menu contextuel résultat d'un clic droit dépend de l'objet sélectionné au moment de l'exécuter.
Application.CommandBars("Toolbar List").Enabled = False
Si tu fais un double-clic, tu obtiendras aussi la liste des différentes barres de menu d'excel
Et pour empêcher ceci sur des versions excel 97 et 2000, voir proprosition Alain Cros.
Si tu as une version excel 2002 ou plus récent, tu peux utiliser ceci :
Application.CommandBars("Toolbar List").Enabled = False
Application.CommandBars.DisableCustomize = True
Proposition d'Alain Cros :
'======================================== > Dans le module ThisWorkbook
Private Sub Workbook_BeforeClose(Cancel As Boolean)
LeHook
End Sub
Private Sub Workbook_Open()
LeHook True
End Sub
Dans un module ordinaire
Private Declare Function LockWindowUpdate& Lib "user32" ( _
ByVal hwndLock&)
Private Declare Function PostMessage& Lib "user32" _
Alias "PostMessageA" (ByVal hwnd&, ByVal wMsg&, ByVal wParam&, ByVal lParam&)
Private Declare Function FindWindowEx& Lib "user32" _
Alias "FindWindowExA" (ByVal hWnd1&, ByVal hWnd2&, ByVal lpsz1$, ByVal lpsz2$)
Private Declare Function GetWindowLong& Lib "user32" _
Alias "GetWindowLongA" (ByVal hwnd&, ByVal nIndex&)
Private Declare Function GetCurrentThreadId Lib "kernel32" () As Long
Private Declare Function SetWindowsHookEx& Lib "user32" _
Alias "SetWindowsHookExA" (ByVal idHook&, ByVal lpfn&, ByVal hmod&, ByVal dwThreadId&)
Private Declare Function GetWindowText& Lib "user32" _
Alias "GetWindowTextA" (ByVal hwnd&, ByVal lpString$, ByVal cch&)
Private Declare Function UnhookWindowsHookEx& Lib "user32" _
(ByVal hHook&)
Private lgHook&
Sub LeHook(Optional cache As Boolean)
Const GWL_HINSTANCE& = -6
If cache Then
InstallHook GetWindowLong(FindWindowEx(0&, 0&, "XLMAIN", _
Application.Caption), GWL_HINSTANCE)
Else
UnhookWindowsHookEx lgHook
End If
End Sub
Sub InstallHook(lgInst&)
Const WH_CBT& = &H5
#If VBA6 Then
lgHook = SetWindowsHookEx(WH_CBT, AddressOf WinHook, _
lgInst, GetCurrentThreadId)
#Else
lgHook = SetWindowsHookEx(WH_CBT, AddrOf("WinHook"), _
lgInst, GetCurrentThreadId)
#End If
End Sub
Private Function WinHook&(ByVal lMsg&, ByVal wParam&, ByRef lParam&)
Const HCBT_ACTIVATE& = &H5, WM_SYSCOMMAND& = &H112, SC_CLOSE& = &HF060&
Dim MYSTR$
If lMsg = HCBT_ACTIVATE Then
LockWindowUpdate wParam
MYSTR = Space$(100&)
MYSTR = Left$(MYSTR, GetWindowText(wParam, MYSTR, 100&))
If MYSTR = "Personnaliser" Or MYSTR = "Personnalisation" Then
PostMessage wParam, WM_SYSCOMMAND, SC_CLOSE, 0&
Else
LockWindowUpdate False
End If
End If
WinHook = False
End Function
'======================================== >
Salutations!
"patrice-toulouse" a écrit dans le message de news:
Merci mais cela ne fonctionne que dans la feuille
Lorsque je clique droit dans les barres de menu j'ai toujours la liste des
différentes barres de menu d'excel qui s'affiche .. j'ai créer une barre
personnelle et masque les autres et ne désire pas que l'utilisateur puisse
les remettre manuellementBonjour
Il faur ajouter dans le code lié au classeur (Module ThisWorkbook) la
procédure suivante :
Private Sub Workbook_SheetBeforeRightClick(ByVal Sh As Object, ByVal
Target As Range, Cancel As Boolean)
Cancel = True
End Sub
PN
www.exefac.com
Bonjour Patrice,
Le menu contextuel résultat d'un clic droit dépend de l'objet sélectionné au moment de l'exécuter.
Application.CommandBars("Toolbar List").Enabled = False
Si tu fais un double-clic, tu obtiendras aussi la liste des différentes barres de menu d'excel
Et pour empêcher ceci sur des versions excel 97 et 2000, voir proprosition Alain Cros.
Si tu as une version excel 2002 ou plus récent, tu peux utiliser ceci :
Application.CommandBars("Toolbar List").Enabled = False
Application.CommandBars.DisableCustomize = True
Proposition d'Alain Cros :
'======================================== > Dans le module ThisWorkbook
Private Sub Workbook_BeforeClose(Cancel As Boolean)
LeHook
End Sub
Private Sub Workbook_Open()
LeHook True
End Sub
Dans un module ordinaire
Private Declare Function LockWindowUpdate& Lib "user32" ( _
ByVal hwndLock&)
Private Declare Function PostMessage& Lib "user32" _
Alias "PostMessageA" (ByVal hwnd&, ByVal wMsg&, ByVal wParam&, ByVal lParam&)
Private Declare Function FindWindowEx& Lib "user32" _
Alias "FindWindowExA" (ByVal hWnd1&, ByVal hWnd2&, ByVal lpsz1$, ByVal lpsz2$)
Private Declare Function GetWindowLong& Lib "user32" _
Alias "GetWindowLongA" (ByVal hwnd&, ByVal nIndex&)
Private Declare Function GetCurrentThreadId Lib "kernel32" () As Long
Private Declare Function SetWindowsHookEx& Lib "user32" _
Alias "SetWindowsHookExA" (ByVal idHook&, ByVal lpfn&, ByVal hmod&, ByVal dwThreadId&)
Private Declare Function GetWindowText& Lib "user32" _
Alias "GetWindowTextA" (ByVal hwnd&, ByVal lpString$, ByVal cch&)
Private Declare Function UnhookWindowsHookEx& Lib "user32" _
(ByVal hHook&)
Private lgHook&
Sub LeHook(Optional cache As Boolean)
Const GWL_HINSTANCE& = -6
If cache Then
InstallHook GetWindowLong(FindWindowEx(0&, 0&, "XLMAIN", _
Application.Caption), GWL_HINSTANCE)
Else
UnhookWindowsHookEx lgHook
End If
End Sub
Sub InstallHook(lgInst&)
Const WH_CBT& = &H5
#If VBA6 Then
lgHook = SetWindowsHookEx(WH_CBT, AddressOf WinHook, _
lgInst, GetCurrentThreadId)
#Else
lgHook = SetWindowsHookEx(WH_CBT, AddrOf("WinHook"), _
lgInst, GetCurrentThreadId)
#End If
End Sub
Private Function WinHook&(ByVal lMsg&, ByVal wParam&, ByRef lParam&)
Const HCBT_ACTIVATE& = &H5, WM_SYSCOMMAND& = &H112, SC_CLOSE& = &HF060&
Dim MYSTR$
If lMsg = HCBT_ACTIVATE Then
LockWindowUpdate wParam
MYSTR = Space$(100&)
MYSTR = Left$(MYSTR, GetWindowText(wParam, MYSTR, 100&))
If MYSTR = "Personnaliser" Or MYSTR = "Personnalisation" Then
PostMessage wParam, WM_SYSCOMMAND, SC_CLOSE, 0&
Else
LockWindowUpdate False
End If
End If
WinHook = False
End Function
'======================================== >
Salutations!
"patrice-toulouse" <patricetoulouse@discussions.microsoft.com> a écrit dans le message de news:
5ACE4196-DEA4-4A9C-A7D5-EA00BDDCA804@microsoft.com...
Merci mais cela ne fonctionne que dans la feuille
Lorsque je clique droit dans les barres de menu j'ai toujours la liste des
différentes barres de menu d'excel qui s'affiche .. j'ai créer une barre
personnelle et masque les autres et ne désire pas que l'utilisateur puisse
les remettre manuellement
Bonjour
Il faur ajouter dans le code lié au classeur (Module ThisWorkbook) la
procédure suivante :
Private Sub Workbook_SheetBeforeRightClick(ByVal Sh As Object, ByVal
Target As Range, Cancel As Boolean)
Cancel = True
End Sub
PN
www.exefac.com
Bonjour Patrice,
Le menu contextuel résultat d'un clic droit dépend de l'objet sélectionné au moment de l'exécuter.
Application.CommandBars("Toolbar List").Enabled = False
Si tu fais un double-clic, tu obtiendras aussi la liste des différentes barres de menu d'excel
Et pour empêcher ceci sur des versions excel 97 et 2000, voir proprosition Alain Cros.
Si tu as une version excel 2002 ou plus récent, tu peux utiliser ceci :
Application.CommandBars("Toolbar List").Enabled = False
Application.CommandBars.DisableCustomize = True
Proposition d'Alain Cros :
'======================================== > Dans le module ThisWorkbook
Private Sub Workbook_BeforeClose(Cancel As Boolean)
LeHook
End Sub
Private Sub Workbook_Open()
LeHook True
End Sub
Dans un module ordinaire
Private Declare Function LockWindowUpdate& Lib "user32" ( _
ByVal hwndLock&)
Private Declare Function PostMessage& Lib "user32" _
Alias "PostMessageA" (ByVal hwnd&, ByVal wMsg&, ByVal wParam&, ByVal lParam&)
Private Declare Function FindWindowEx& Lib "user32" _
Alias "FindWindowExA" (ByVal hWnd1&, ByVal hWnd2&, ByVal lpsz1$, ByVal lpsz2$)
Private Declare Function GetWindowLong& Lib "user32" _
Alias "GetWindowLongA" (ByVal hwnd&, ByVal nIndex&)
Private Declare Function GetCurrentThreadId Lib "kernel32" () As Long
Private Declare Function SetWindowsHookEx& Lib "user32" _
Alias "SetWindowsHookExA" (ByVal idHook&, ByVal lpfn&, ByVal hmod&, ByVal dwThreadId&)
Private Declare Function GetWindowText& Lib "user32" _
Alias "GetWindowTextA" (ByVal hwnd&, ByVal lpString$, ByVal cch&)
Private Declare Function UnhookWindowsHookEx& Lib "user32" _
(ByVal hHook&)
Private lgHook&
Sub LeHook(Optional cache As Boolean)
Const GWL_HINSTANCE& = -6
If cache Then
InstallHook GetWindowLong(FindWindowEx(0&, 0&, "XLMAIN", _
Application.Caption), GWL_HINSTANCE)
Else
UnhookWindowsHookEx lgHook
End If
End Sub
Sub InstallHook(lgInst&)
Const WH_CBT& = &H5
#If VBA6 Then
lgHook = SetWindowsHookEx(WH_CBT, AddressOf WinHook, _
lgInst, GetCurrentThreadId)
#Else
lgHook = SetWindowsHookEx(WH_CBT, AddrOf("WinHook"), _
lgInst, GetCurrentThreadId)
#End If
End Sub
Private Function WinHook&(ByVal lMsg&, ByVal wParam&, ByRef lParam&)
Const HCBT_ACTIVATE& = &H5, WM_SYSCOMMAND& = &H112, SC_CLOSE& = &HF060&
Dim MYSTR$
If lMsg = HCBT_ACTIVATE Then
LockWindowUpdate wParam
MYSTR = Space$(100&)
MYSTR = Left$(MYSTR, GetWindowText(wParam, MYSTR, 100&))
If MYSTR = "Personnaliser" Or MYSTR = "Personnalisation" Then
PostMessage wParam, WM_SYSCOMMAND, SC_CLOSE, 0&
Else
LockWindowUpdate False
End If
End If
WinHook = False
End Function
'======================================== >
Salutations!
"patrice-toulouse" a écrit dans le message de news:
Merci mais cela ne fonctionne que dans la feuille
Lorsque je clique droit dans les barres de menu j'ai toujours la liste des
différentes barres de menu d'excel qui s'affiche .. j'ai créer une barre
personnelle et masque les autres et ne désire pas que l'utilisateur puisse
les remettre manuellementBonjour
Il faur ajouter dans le code lié au classeur (Module ThisWorkbook) la
procédure suivante :
Private Sub Workbook_SheetBeforeRightClick(ByVal Sh As Object, ByVal
Target As Range, Cancel As Boolean)
Cancel = True
End Sub
PN
www.exefac.com
Bonjour Patrice,
Le menu contextuel résultat d'un clic droit dépend de l'objet sélectionné au moment de l'exécuter.
Application.CommandBars("Toolbar List").Enabled = False
Si tu fais un double-clic, tu obtiendras aussi la liste des différentes barres de menu d'excel
Et pour empêcher ceci sur des versions excel 97 et 2000, voir proprosition Alain Cros.
Si tu as une version excel 2002 ou plus récent, tu peux utiliser ceci :
Application.CommandBars("Toolbar List").Enabled = False
Application.CommandBars.DisableCustomize = True
Proposition d'Alain Cros :
'======================================== > Dans le module ThisWorkbook
Private Sub Workbook_BeforeClose(Cancel As Boolean)
LeHook
End Sub
Private Sub Workbook_Open()
LeHook True
End Sub
Dans un module ordinaire
Private Declare Function LockWindowUpdate& Lib "user32" ( _
ByVal hwndLock&)
Private Declare Function PostMessage& Lib "user32" _
Alias "PostMessageA" (ByVal hwnd&, ByVal wMsg&, ByVal wParam&, ByVal lParam&)
Private Declare Function FindWindowEx& Lib "user32" _
Alias "FindWindowExA" (ByVal hWnd1&, ByVal hWnd2&, ByVal lpsz1$, ByVal lpsz2$)
Private Declare Function GetWindowLong& Lib "user32" _
Alias "GetWindowLongA" (ByVal hwnd&, ByVal nIndex&)
Private Declare Function GetCurrentThreadId Lib "kernel32" () As Long
Private Declare Function SetWindowsHookEx& Lib "user32" _
Alias "SetWindowsHookExA" (ByVal idHook&, ByVal lpfn&, ByVal hmod&, ByVal dwThreadId&)
Private Declare Function GetWindowText& Lib "user32" _
Alias "GetWindowTextA" (ByVal hwnd&, ByVal lpString$, ByVal cch&)
Private Declare Function UnhookWindowsHookEx& Lib "user32" _
(ByVal hHook&)
Private lgHook&
Sub LeHook(Optional cache As Boolean)
Const GWL_HINSTANCE& = -6
If cache Then
InstallHook GetWindowLong(FindWindowEx(0&, 0&, "XLMAIN", _
Application.Caption), GWL_HINSTANCE)
Else
UnhookWindowsHookEx lgHook
End If
End Sub
Sub InstallHook(lgInst&)
Const WH_CBT& = &H5
#If VBA6 Then
lgHook = SetWindowsHookEx(WH_CBT, AddressOf WinHook, _
lgInst, GetCurrentThreadId)
#Else
lgHook = SetWindowsHookEx(WH_CBT, AddrOf("WinHook"), _
lgInst, GetCurrentThreadId)
#End If
End Sub
Private Function WinHook&(ByVal lMsg&, ByVal wParam&, ByRef lParam&)
Const HCBT_ACTIVATE& = &H5, WM_SYSCOMMAND& = &H112, SC_CLOSE& = &HF060&
Dim MYSTR$
If lMsg = HCBT_ACTIVATE Then
LockWindowUpdate wParam
MYSTR = Space$(100&)
MYSTR = Left$(MYSTR, GetWindowText(wParam, MYSTR, 100&))
If MYSTR = "Personnaliser" Or MYSTR = "Personnalisation" Then
PostMessage wParam, WM_SYSCOMMAND, SC_CLOSE, 0&
Else
LockWindowUpdate False
End If
End If
WinHook = False
End Function
'======================================== >
Salutations!
"patrice-toulouse" a écrit dans le message de news:
Merci mais cela ne fonctionne que dans la feuille
Lorsque je clique droit dans les barres de menu j'ai toujours la liste des
différentes barres de menu d'excel qui s'affiche .. j'ai créer une barre
personnelle et masque les autres et ne désire pas que l'utilisateur puisse
les remettre manuellementBonjour
Il faur ajouter dans le code lié au classeur (Module ThisWorkbook) la
procédure suivante :
Private Sub Workbook_SheetBeforeRightClick(ByVal Sh As Object, ByVal
Target As Range, Cancel As Boolean)
Cancel = True
End Sub
PN
www.exefac.com
Bonjour Patrice,
Le menu contextuel résultat d'un clic droit dépend de l'objet sélectionné au moment de l'exécuter.
Application.CommandBars("Toolbar List").Enabled = False
Si tu fais un double-clic, tu obtiendras aussi la liste des différentes barres de menu d'excel
Et pour empêcher ceci sur des versions excel 97 et 2000, voir proprosition Alain Cros.
Si tu as une version excel 2002 ou plus récent, tu peux utiliser ceci :
Application.CommandBars("Toolbar List").Enabled = False
Application.CommandBars.DisableCustomize = True
Proposition d'Alain Cros :
'======================================== > Dans le module ThisWorkbook
Private Sub Workbook_BeforeClose(Cancel As Boolean)
LeHook
End Sub
Private Sub Workbook_Open()
LeHook True
End Sub
Dans un module ordinaire
Private Declare Function LockWindowUpdate& Lib "user32" ( _
ByVal hwndLock&)
Private Declare Function PostMessage& Lib "user32" _
Alias "PostMessageA" (ByVal hwnd&, ByVal wMsg&, ByVal wParam&, ByVal lParam&)
Private Declare Function FindWindowEx& Lib "user32" _
Alias "FindWindowExA" (ByVal hWnd1&, ByVal hWnd2&, ByVal lpsz1$, ByVal lpsz2$)
Private Declare Function GetWindowLong& Lib "user32" _
Alias "GetWindowLongA" (ByVal hwnd&, ByVal nIndex&)
Private Declare Function GetCurrentThreadId Lib "kernel32" () As Long
Private Declare Function SetWindowsHookEx& Lib "user32" _
Alias "SetWindowsHookExA" (ByVal idHook&, ByVal lpfn&, ByVal hmod&, ByVal dwThreadId&)
Private Declare Function GetWindowText& Lib "user32" _
Alias "GetWindowTextA" (ByVal hwnd&, ByVal lpString$, ByVal cch&)
Private Declare Function UnhookWindowsHookEx& Lib "user32" _
(ByVal hHook&)
Private lgHook&
Sub LeHook(Optional cache As Boolean)
Const GWL_HINSTANCE& = -6
If cache Then
InstallHook GetWindowLong(FindWindowEx(0&, 0&, "XLMAIN", _
Application.Caption), GWL_HINSTANCE)
Else
UnhookWindowsHookEx lgHook
End If
End Sub
Sub InstallHook(lgInst&)
Const WH_CBT& = &H5
#If VBA6 Then
lgHook = SetWindowsHookEx(WH_CBT, AddressOf WinHook, _
lgInst, GetCurrentThreadId)
#Else
lgHook = SetWindowsHookEx(WH_CBT, AddrOf("WinHook"), _
lgInst, GetCurrentThreadId)
#End If
End Sub
Private Function WinHook&(ByVal lMsg&, ByVal wParam&, ByRef lParam&)
Const HCBT_ACTIVATE& = &H5, WM_SYSCOMMAND& = &H112, SC_CLOSE& = &HF060&
Dim MYSTR$
If lMsg = HCBT_ACTIVATE Then
LockWindowUpdate wParam
MYSTR = Space$(100&)
MYSTR = Left$(MYSTR, GetWindowText(wParam, MYSTR, 100&))
If MYSTR = "Personnaliser" Or MYSTR = "Personnalisation" Then
PostMessage wParam, WM_SYSCOMMAND, SC_CLOSE, 0&
Else
LockWindowUpdate False
End If
End If
WinHook = False
End Function
'======================================== >
Salutations!
"patrice-toulouse" <patricetoulouse@discussions.microsoft.com> a écrit dans le message de news:
5ACE4196-DEA4-4A9C-A7D5-EA00BDDCA804@microsoft.com...
Merci mais cela ne fonctionne que dans la feuille
Lorsque je clique droit dans les barres de menu j'ai toujours la liste des
différentes barres de menu d'excel qui s'affiche .. j'ai créer une barre
personnelle et masque les autres et ne désire pas que l'utilisateur puisse
les remettre manuellement
Bonjour
Il faur ajouter dans le code lié au classeur (Module ThisWorkbook) la
procédure suivante :
Private Sub Workbook_SheetBeforeRightClick(ByVal Sh As Object, ByVal
Target As Range, Cancel As Boolean)
Cancel = True
End Sub
PN
www.exefac.com
Bonjour Patrice,
Le menu contextuel résultat d'un clic droit dépend de l'objet sélectionné au moment de l'exécuter.
Application.CommandBars("Toolbar List").Enabled = False
Si tu fais un double-clic, tu obtiendras aussi la liste des différentes barres de menu d'excel
Et pour empêcher ceci sur des versions excel 97 et 2000, voir proprosition Alain Cros.
Si tu as une version excel 2002 ou plus récent, tu peux utiliser ceci :
Application.CommandBars("Toolbar List").Enabled = False
Application.CommandBars.DisableCustomize = True
Proposition d'Alain Cros :
'======================================== > Dans le module ThisWorkbook
Private Sub Workbook_BeforeClose(Cancel As Boolean)
LeHook
End Sub
Private Sub Workbook_Open()
LeHook True
End Sub
Dans un module ordinaire
Private Declare Function LockWindowUpdate& Lib "user32" ( _
ByVal hwndLock&)
Private Declare Function PostMessage& Lib "user32" _
Alias "PostMessageA" (ByVal hwnd&, ByVal wMsg&, ByVal wParam&, ByVal lParam&)
Private Declare Function FindWindowEx& Lib "user32" _
Alias "FindWindowExA" (ByVal hWnd1&, ByVal hWnd2&, ByVal lpsz1$, ByVal lpsz2$)
Private Declare Function GetWindowLong& Lib "user32" _
Alias "GetWindowLongA" (ByVal hwnd&, ByVal nIndex&)
Private Declare Function GetCurrentThreadId Lib "kernel32" () As Long
Private Declare Function SetWindowsHookEx& Lib "user32" _
Alias "SetWindowsHookExA" (ByVal idHook&, ByVal lpfn&, ByVal hmod&, ByVal dwThreadId&)
Private Declare Function GetWindowText& Lib "user32" _
Alias "GetWindowTextA" (ByVal hwnd&, ByVal lpString$, ByVal cch&)
Private Declare Function UnhookWindowsHookEx& Lib "user32" _
(ByVal hHook&)
Private lgHook&
Sub LeHook(Optional cache As Boolean)
Const GWL_HINSTANCE& = -6
If cache Then
InstallHook GetWindowLong(FindWindowEx(0&, 0&, "XLMAIN", _
Application.Caption), GWL_HINSTANCE)
Else
UnhookWindowsHookEx lgHook
End If
End Sub
Sub InstallHook(lgInst&)
Const WH_CBT& = &H5
#If VBA6 Then
lgHook = SetWindowsHookEx(WH_CBT, AddressOf WinHook, _
lgInst, GetCurrentThreadId)
#Else
lgHook = SetWindowsHookEx(WH_CBT, AddrOf("WinHook"), _
lgInst, GetCurrentThreadId)
#End If
End Sub
Private Function WinHook&(ByVal lMsg&, ByVal wParam&, ByRef lParam&)
Const HCBT_ACTIVATE& = &H5, WM_SYSCOMMAND& = &H112, SC_CLOSE& = &HF060&
Dim MYSTR$
If lMsg = HCBT_ACTIVATE Then
LockWindowUpdate wParam
MYSTR = Space$(100&)
MYSTR = Left$(MYSTR, GetWindowText(wParam, MYSTR, 100&))
If MYSTR = "Personnaliser" Or MYSTR = "Personnalisation" Then
PostMessage wParam, WM_SYSCOMMAND, SC_CLOSE, 0&
Else
LockWindowUpdate False
End If
End If
WinHook = False
End Function
'======================================== >
Salutations!
"patrice-toulouse" a écrit dans le message de news:
Merci mais cela ne fonctionne que dans la feuille
Lorsque je clique droit dans les barres de menu j'ai toujours la liste des
différentes barres de menu d'excel qui s'affiche .. j'ai créer une barre
personnelle et masque les autres et ne désire pas que l'utilisateur puisse
les remettre manuellementBonjour
Il faur ajouter dans le code lié au classeur (Module ThisWorkbook) la
procédure suivante :
Private Sub Workbook_SheetBeforeRightClick(ByVal Sh As Object, ByVal
Target As Range, Cancel As Boolean)
Cancel = True
End Sub
PN
www.exefac.com