Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default Disable Cut/Copy/Paste in Excel 2010

Good morning.

I've used various different recommendations that people have offered to disable the Cut/Copy/Paste functionality in Excel 2010.

And, with one exception, the recommendations have worked. I'm able to disable the functionality for the right_click action and the <cntl x, c, and v actions.

However, I've been unsuccessful in disabling the Cut/Copy/Paste functionality for the icons in Excel 2010.

Have others encountered this problem with the icons, (scissors, two sheets of paper side by side, and clipboard)? If so, any solution you've found would be greatly appreciated. Thank you for your time and consideration.

Here's the code I've been using, unsuccessfully.

Workbook VBA

Option Explicit

Private Sub Workbook_Activate()
Call ToggleCutCopyAndPaste(False)
End Sub

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Call ToggleCutCopyAndPaste(True)
End Sub

Private Sub Workbook_Deactivate()
Call ToggleCutCopyAndPaste(True)
End Sub

Private Sub Workbook_Open()
Call ToggleCutCopyAndPaste(False)
End Sub

Module VBA

Option Explicit

Sub ToggleCutCopyAndPaste(Allow As Boolean)
'Activate/deactivate cut, copy, paste and pastespecial menu items
Call EnableMenuItem(21, Allow) ' cut
Call EnableMenuItem(19, Allow) ' copy
Call EnableMenuItem(22, Allow) ' paste
Call EnableMenuItem(755, Allow) ' pastespecial

'Activate/deactivate drag and drop ability
Application.CellDragAndDrop = Allow

'Activate/deactivate cut, copy, paste and pastespecial shortcut keys
With Application
Select Case Allow
Case Is = False
.OnKey "^c", "CutCopyPasteDisabled"
.OnKey "^v", "CutCopyPasteDisabled"
.OnKey "^x", "CutCopyPasteDisabled"
.OnKey "+{DEL}", "CutCopyPasteDisabled"
.OnKey "^{INSERT}", "CutCopyPasteDisabled"
Case Is = True
.OnKey "^c"
.OnKey "^v"
.OnKey "^x"
.OnKey "+{DEL}"
.OnKey "^{INSERT}"
End Select
End With
End Sub

Sub EnableMenuItem(ctlId As Integer, Enabled As Boolean)

intCounter = 1
'Activate/Deactivate specific menu item
Dim cBar As CommandBar
Dim cBarCtrl As CommandBarControl
For Each cBar In Application.CommandBars
If cBar.Name < "Clipboard" Then
Set cBarCtrl = cBar.FindControl(ID:=ctlId, recursive:=True)
If Not cBarCtrl Is Nothing Then cBarCtrl.Enabled = Enabled
End If
Next
End Sub

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
XCL 2010 VBA: I want to copy/paste from a rtf file to a spreadsheet JingleRock[_2_] Excel Programming 7 November 13th 11 10:50 PM
Excel 2010 code wont copy/paste to values jaxgab Excel Programming 3 February 16th 11 04:53 PM
Disable Copy/Paste Richard[_37_] Excel Programming 4 August 14th 07 10:59 PM
Disable copy and paste Igneshwara reddy[_2_] Excel Worksheet Functions 0 March 12th 07 05:20 PM
For dates, copy/paste special/values for 2006 gives me 2010--Why geraldjoh Excel Worksheet Functions 3 July 23rd 06 01:12 AM


All times are GMT +1. The time now is 08:03 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"