开发者

Disable copy(ctrl+c), paste(ctrl+v),cut(ctrl+x) in excel

开发者 https://www.devze.com 2023-02-07 00:32 出处:网络
I have developed the vsto template in C# in which,i have added data validation for many fields in the excel sheet.If the user copy paste the content, those validations rules are overwrit开发者_如何学编

I have developed the vsto template in C# in which,i have added data validation for many fields in the excel sheet.If the user copy paste the content, those validations rules are overwrit开发者_如何学编程es and does not work. how can i restrict user to copy,paste,cut.**Is there any **other way to overcome this problem?


Have you tried protecting the workbook ? Two ways to do the same

1.)manually

2.)programatically


Following code should intercept Ctrl+V and effectively disable it

1.To disable the Paste Option(ctrl + v )

Application.OnKey("^v", "");

2.To enable the Paste Option(ctrl + v ) again

Application.OnKey("^v", Type.Missing);
0

精彩评论

暂无评论...
验证码 换一张
取 消