Microsoft 365 Interdire double clic et clic droit

Usine à gaz

XLDnaute Barbatruc
Supporter XLD
Bonjour à toutes et à tous,
Je vous souhaite un beau dimanche :)

Mes petites élucubrations du dimanche (lol ça me détend ;))
Dans le fichier test joint, je bloque les double clic et clic droit.
Jusque là pas de souci :
VB:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
If Not Application.Intersect(Target, Range("a1:z10000")) Is Nothing Then
Application.ScreenUpdating = False
    MsgBox ("C'est un seul clic !" & nbcel)
CreateObject("wscript.shell").SendKeys "{ESC}" 'Gérard
Application.ScreenUpdating = True
Exit Sub
End If
End Sub
Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As Boolean)
If Not Application.Intersect(Target, Range("a1:z10000")) Is Nothing Then
Application.ScreenUpdating = False
    MsgBox ("C'est un clic gauche !" & nbcel)
CreateObject("wscript.shell").SendKeys "{ESC}" 'Gérard
Application.ScreenUpdating = True
Exit Sub
End If
End Sub
J'ai une interrogation que je n'arrive pas à résoudre.
Souci d'affichage ou pour faire avancer le Schmilblick (1976) 😄

Quand je fais un clic droit, après avoir validé le MsgBox, la fenêtre apparaît :
1622983325224.png

Très furtivement, c'est- vrai : mais je voudrais ne pas la voir du tout lol :)
Auriez-vous la solution ?
Avec mes remerciements,
Amicalement,
lionel,
 

Pièces jointes

  • clic.xlsm
    16 KB · Affichages: 13
Solution
Bonjour,
Cancel = True

VB:
Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As Boolean)
If Not Application.Intersect(Target, Range("a1:z10000")) Is Nothing Then
Application.ScreenUpdating = False
Cancel = True
    MsgBox ("C'est un clic gauche !" & nbcel)
CreateObject("wscript.shell").SendKeys "{ESC}" 'Gérard
Application.ScreenUpdating = True
Exit Sub
End If
End Sub

laurent950

XLDnaute Accro
Bonjour,
Cancel = True

VB:
Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As Boolean)
If Not Application.Intersect(Target, Range("a1:z10000")) Is Nothing Then
Application.ScreenUpdating = False
Cancel = True
    MsgBox ("C'est un clic gauche !" & nbcel)
CreateObject("wscript.shell").SendKeys "{ESC}" 'Gérard
Application.ScreenUpdating = True
Exit Sub
End If
End Sub
 

soan

XLDnaute Barbatruc
Inactif
Bonjour Lionel, le fil,

Titre du sujet : « Interdire double clic et clic droit »

voici ma solution très simple, qui n'a rien d'une usine à gaz :
débranche la souris ! 😊 y'a même 3 bonus : le clic gauche aussi est interdit, ainsi que la molette de la souris. (utilisation de la molette pour défilement haut ou bas, et pression sur la molette qui fait que ça équivaut à un 3ème bouton)

soan
 

Discussions similaires

Statistiques des forums

Discussions
311 724
Messages
2 081 936
Membres
101 844
dernier inscrit
pktla