#1
|
|||
|
|||
Disable cut, copy and paste
Greetings friends of the forum, I would like to know how to achieve that in a custom Word file that I deliver to my student, he cannot cut, copy or paste, not Ctrl + x, Ctrl + C, Ctrl + V. I want it that way to make the student write for himself the homework he sends. I have a code that doesn't work for me but I know there must be some way. HTML Code:
Private Sub Workbook_Activate() Dim oCtrl As Office.CommandBarControl 'Deshabilita Cut del todo el menu For Each oCtrl In Application.CommandBars.FindControls(ID:=21) oCtrl.Enabled = False Next oCtrl 'Deshabilita Copy del todo el menu For Each oCtrl In Application.CommandBars.FindControls(ID:=19) oCtrl.Enabled = False Next oCtrl 'Deshabilita Paste del todo el menu For Each oCtrl In Application.CommandBars.FindControls(ID:=6002) oCtrl.Enabled = False Next oCtrl Application.CellDragAndDrop = False End Sub Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range) With Application .CellDragAndDrop = False .CutCopyMode = False 'Clear clipboard End With End Sub I appreciate your support in advance |
#2
|
||||
|
||||
What you ask is impossible. ANYTHING that you allow someone to see or hear can be copied. I recall seeing some fake traveller's cheques that had been produced on an Apple Mac back in the 90s that were such good copies the bank had difficulty identifying them. Your document would be child's play by comparison.
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
#3
|
|||
|
|||
Greetings, Thank you, I really expected the macro to exist because in reality, the point is not if it will strictly serve the purpose but rather how it can be achieved with macros that are disabled. Indeed for every expert that would be an intention of children. But the file will not be provided to an expert but rather to those who only know how to write in word, but they also have the habit of easily copying, cutting and pasting from another source instead of writing by themselves with their own knowledge These are students who are not from the Informatics Degree. If they were to solve that they can be copied from other sources, at least it will cost them to consult an expert to solve the problem. I have managed to do this in Excel but not in Word. So for this reason I go to the experts of a forum in which we only share among those who know more and know little, ... the others, that is to say those who have not even heard of VBA surely do not enter these sites.
That is why I will continue to wait to see if anyone else has any proposal to demonstrate and collaborate |
#4
|
||||
|
||||
A macro solution is easily circumvented by disabling macros - which is the default for any file obtained from email or a website. They don't have to be a genius to avoid your restriction.
Perhaps you could lock an entire document and only enable editing via a userform. This at least forces regular users into running macros.
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
#5
|
||||
|
||||
The attached might work for you. It works on the premise of having a first section that contains a warning and the rest of the document is hidden. If macros are enabled copy and paste are inhibited and the hidden text is exposed and the first section hidden.
It is not foolproof, but it should fox a few who are not familiar with hidden text and macros. I have not protected the code but you should - again that's not foolproof, but it may help. Don't underestimate the ability of people to circumvent such measures.
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
#6
|
|||
|
|||
Guessed
"They don't have to be a genius to avoid your restriction." Thank you, effectively I do not try to underestimate the intelligence of anyone, but it is also real in that there are many people who do not realize the solution that is in front, of course, a simple not to accept the macro would already be the solution. I will see how this idea is walked. The solution that gmayor gently offers me is interesting in the face of this dilemma, as far as Vba is concerned and for many who understand this code simply by entering and commenting on it or deleting it so that this instruction is eliminated. Of course. Placing a code is another step of difficulty for the neophytes. Now, the vba coding of gmayor is not so easy for me to understand . For example, I don't see where it blocks the Copy instruction, however, we have Sub EditCopy (): Exit Sub: End Sub EditCopy is just the name of the macro and Exit sub disables something but how does it relate to Copy? ... It worked well to avoid copy, paste, ... But I lacked for the Cut instruction because if it allows me to cut and paste in another document. Could you please complete me or tell me to avoid cutting ??? I know that something is going to help, I don't know how long, but my students will have nothing left but to write in the document what they discern for themselves for the written explanation. Thank you gmayor |
#7
|
|||
|
|||
In addition, I have just discovered that using the special paste is able to bring text from other documents, therefore this in necessary also disable it, because without doing anything special the problem is already solved . I would like this to be blocked too
Cut Special paste I thank you very much for your help |
#8
|
||||
|
||||
EditCopy, EditPaste etc intercept those built-in commands. To prevent cutting create another similar macro called EditCut. For Paste Special EditPasteSpecial
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
#9
|
|||
|
|||
Thanks, gmayor,
its seems magical by simply placing... Sub EditCut () Exit Sub End Sub cut disable function worked But this code: Sub EditPasteSpecial () Exit Sub End Sub It did not work, if I copy or cut another document, the special paste works, which I would not want because it is required to also be disabled. |
#10
|
||||
|
||||
It works here. Add another line e.g.
Code:
Sub EditPasteSpecial() MsgBox "Pasting is not allowed" Exit Sub End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
#11
|
|||
|
|||
Not,...
EditPasteSpecial it does not work |
#12
|
|||
|
|||
Regards, gmayor,
Trying to find a solution for EditPasteSpecial, I found this: Apparently I have not been the only one who has seen this need or you to the first to help you on this issue. I found this link: https://groups.google.com/forum/#!to...al/8DuqbGS4aqw |
#13
|
|||
|
|||
Hi
This code apparently is only for version 2003, Sub EditPasteSpecial() If Selection.StartIsActive Then Selection.Delete End If Exit Sub End Sub what would it be version since 2013??? |
#14
|
|||
|
|||
I'd like to know the solution for Disable cut, copy and paste too in Word Macro
I'd like to know the solution for Disable cut, copy and paste too in Word Macro. Word version: word 2019
|
Thread Tools | |
Display Modes | |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Disable Paste in specific range | il_betto | Excel Programming | 2 | 06-12-2019 12:06 AM |
Copy and paste | AUBuck | Excel | 1 | 07-20-2017 12:07 PM |
When I copy&paste a second copy appears that can't be edited | makeo22 | Word | 3 | 04-26-2017 07:09 PM |
Copy / paste | BoyertownCasket | Excel | 4 | 04-19-2016 12:32 AM |
Paste Special: Copy and Paste Formatting Only? | tinfanide | Word | 6 | 03-06-2013 12:21 AM |