Microsoft 365 Empêcher l'affichage de la boite de dialogue copier/coller

Usine à gaz

XLDnaute Barbatruc
Supporter XLD
Bonjour à toutes et à tous :)

J'ai un petit souci sur un code 'petit souci" mais souci qui m'énerve Grrr !!! lol
le but de mon code en feuil1
VB:
Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As Boolean)
If Not Application.Intersect(Target, Range("J6:J10000")) Is Nothing Then
'    If Cells(ActiveCell.Row, 11) <> "" Then
        Application.EnableEvents = False
        Application.ScreenUpdating = False
'        Pass_admin.Show 'neutralisé pour le test
        [a1].Select
        Application.EnableEvents = True
        CreateObject("wscript.shell").SendKeys "{Escape}"
        Application.ScreenUpdating = True
        Exit Sub
'    End If
End If
End Sub

est, outre l'affichage d'un UF "Pass_admin.Show neutralisé pour le test",
d'empêcher l'affichage de la boite de dialogue :
1678711457302.png

J'ai réussi à la refermer avec : CreateObject("wscript.shell").SendKeys "{Escape}"
Mais, Malgré Application.ScreenUpdating = false je la vois encore,
Furtivement c'est vrai, mais je la vois Et ça m'énerve lol

Est-il possible de ne pas la voir du tout ?

En cas, je joins le petit fichier test...

Merci à toutes et à tous,
:)
 

Pièces jointes

  • clic droit test.xlsm
    29.5 KB · Affichages: 3

job75

XLDnaute Barbatruc
Bonjour Lionel,

Ceci devrait convenir :
VB:
Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As Boolean)
If Not Application.Intersect(Target, Range("J6:J10000")) Is Nothing Then Cancel = True
End Sub
A+
 

fanch55

XLDnaute Barbatruc
Salut Lionel,
Et le cancel inhérent, tu l'as oublié ?
VB:
Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As Boolean)
    If Not Application.Intersect(Target, Range("J6:J19")) Is Nothing Then
        Cancel = True
    End If
End Sub
 

Discussions similaires