View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Jialiang Ge [MSFT] Jialiang Ge [MSFT] is offline
external usenet poster
 
Posts: 118
Default Disabling Cut Copy and Paste buttons in toolbar

Hello Adrian,

I agree with Jim Rech, and apart from his macro, I find another one at:
http://www.ozgrid.com/VBA/disable-cut-copy.htm
It calls Application.CellDragAndDrop = False and Application.CutCopyMode =
False to disable cut/copy, however, it doesn't disable the Paste behavior.
To disable Paste, I'd suggest Jim's routine:

Sub AllowPastes(EnableBool As Boolean)
Dim oCtls As CommandBarControls, oCtl As CommandBarControl
Set oCtls = CommandBars.FindControls(ID:=22) ''Paste
If Not oCtls Is Nothing Then
For Each oCtl In oCtls
oCtl.Enabled = EnableBool
Next
End If
Set oCtls = CommandBars.FindControls(ID:=522)
If Not oCtls Is Nothing Then
For Each oCtl In oCtls
''Disable Options so D&D cannot be restored
oCtl.Enabled = EnableBool
Next
End If
With Application
.CellDragAndDrop = EnableBool
If EnableBool Then
.OnKey "^v"
.OnKey "+{Del}"
Else
.OnKey "^v", ""
.OnKey "+{Del}", ""
End If
End With
End Sub

The complete command bar control ID list can be found at
http://support.microsoft.com/kb/213552

If you have any other concerns or questions, feel free to let me know

Regards,
Jialiang Ge , remove 'online.')
Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.