Interdire le copier coller

Description

Permet d'interdire le Copier/Coller à partir de votre prog vers un doc Word, Excell...

Source / Exemple :


Option Explicit
Dim Interdit As Boolean

Private Sub cmd_Interdire_Click()
    If Clipboard.GetFormat(vbCFText) Or Clipboard.GetFormat(vbCFRTF) Then
        Clipboard.Clear
    End If
    If cmd_Interdire.Caption = "Interdire le Copier/Coller !" Then
        cmd_Interdire.Caption = "Autoriser le Copier/Coller !"
        Interdit = True
        Exit Sub
    End If
    If cmd_Interdire.Caption = "Autoriser le Copier/Coller !" Then
        cmd_Interdire.Caption = "Interdire le Copier/Coller !"       
        Interdit = False
        Exit Sub
    End If

End Sub

Private Sub cmd_Quitter_Click()
    End
End Sub

Private Sub Form_Load()   
    Interdit = False
End Sub

Private Sub TextDroite_KeyDown(KeyCode As Integer, Shift As Integer)
Dim CTRL_EnfonceD As Integer
Dim Response As Integer
    If Interdit = True Then
        CTRL_EnfonceD = (Shift And KeyCode) > 0       
        If CTRL_EnfonceD Then
            MsgBox "Copier/Coller interdit !" & Chr(10) & "Pour y être autorisé, appuyer sur le bouton." & Chr(13) & Chr(13) & "   ---PL@cidBlue07---", vbExclamation, "   Attention !"          
            If Clipboard.GetFormat(vbCFText) Or Clipboard.GetFormat(vbCFRTF) Then
                Clipboard.Clear
            End If
        End If
    End If
End Sub

Private Sub TextDroite_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If Interdit = True Then     
        If Button = 2 Then
            MsgBox "Copier/Coller interdit !" & Chr(10) & "Pour y être autorisé, appuyer sur le bouton." & Chr(13) & Chr(13) & "   ---PL@cidBlue07---", vbExclamation, "   Attention !"
        End If
    End If
End Sub

Private Sub TextGauche_KeyDown(KeyCode As Integer, Shift As Integer)
Dim CTRL_EnfonceG As Integer
Dim Response As Integer
    If Interdit = True Then
        CTRL_EnfonceG = (Shift And KeyCode) > 0       
        If CTRL_EnfonceG Then
            MsgBox "Copier/Coller interdit !" & Chr(10) & "Pour y être autorisé, appuyer sur le bouton." & Chr(13) & Chr(13) & "   ---Pl@cidBlue07---", vbExclamation, "   Attention !"           
            If Clipboard.GetFormat(vbCFText) Or Clipboard.GetFormat(vbCFRTF) Then
                Clipboard.Clear
            End If
        End If
    End If
End Sub

Private Sub TextGauche_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If Interdit = True Then       
        If Button = 2 Then
            MsgBox "Copier/Coller interdit !" & Chr(10) & "Pour y être autorisé, appuyer sur le bouton." & Chr(13) & Chr(13) & "   ---Pl@cidBlue07---", vbExclamation, "   Attention !"
        End If
    End If
End Sub

Conclusion :


C 1 truc simple ya peut etre mieux, si vous connaissez faites le savoir! merci !
(C'est mon 1° prog ici alors ne soyez pas trop mechant!)

Codes Sources

A voir également

Vous n'êtes pas encore membre ?

inscrivez-vous, c'est gratuit et ça prend moins d'une minute !

Les membres obtiennent plus de réponses que les utilisateurs anonymes.

Le fait d'être membre vous permet d'avoir un suivi détaillé de vos demandes et codes sources.

Le fait d'être membre vous permet d'avoir des options supplémentaires.