How to stop the user cutting and pasting, using keyboard shortcuts, while still allowing copying to clipboard

Posted by: nick-westbyihsenergy-com on 8 September 2017, 1:37 pm EST

  • Posted 8 September 2017, 1:37 pm EST

    <P>How can I easily stop the user from cutting (Ctrl+X, Shift+Del) and pasting (Ctrl+V, Shift+Ins) on my spreadsheet, but still allow him to copy (Ctrl+C, Ctrl+Ins) to the clipboard?</P>
    <P>I have a number of sheets which have complicated formulas and formats and while I want to allow the user to copy the selected range to the clipboard I do not want him to cut the range or paste the clipboard contents into my spreadsheet.  I have used the <FONT color=#0000ff size=2>protected</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>override</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>bool</FONT><FONT size=2> ProcessCmdKey () functionality to stop the user pasting by setting the clipboard contents to null, but i cannot see how to stop the cutting.</FONT></P>
    <P><FONT size=2> If I use workbook.AutoClipboard = false then this disables all cut, paste and copy keyboard shortcuts, which is more than I want disabled.</FONT></P>
    <P> I am using 4.0.3503.2008</P>
    <P> Thanks in anticipation</P>
    <P>Nick<FONT size=2></P></FONT>
  • Replied 8 September 2017, 1:37 pm EST

    <p>Nick -</p><p>You should be able to set up inputmaps for those key combinations and set the SpreadAction to none. <br></p>
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels