Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Disabling Cut Copy and Paste buttons in toolbar

Hi, I'm looking for some code to disable the cut,copy and paste buttons
within the toolbar. I've foudn some for the menus, so I assume it is similar.
Struggling to find solution. If anyone has already done this, if you could
point me in the right direction it will save me some frustration. Thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default Disabling Cut Copy and Paste buttons in toolbar


I assume what you are looking for is a reference to the Toolbars...
Application.CommandBars("Formatting") and
Application.CommandBars (Standard")

But what about the cell right-click menu or the row/column headers right-click menu?
And there is always Ctrl + C or Ctrl + X and Ctrl + V.
Also, drag and drop is the same as cut and paste.
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)



"Adrian Turner"
wrote in message
Hi, I'm looking for some code to disable the cut,copy and paste buttons
within the toolbar. I've foudn some for the menus, so I assume it is similar.
Struggling to find solution. If anyone has already done this, if you could
point me in the right direction it will save me some frustration. Thanks
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 533
Default Disabling Cut Copy and Paste buttons in toolbar

This routine disables/enables Cuts and Drag & Drop. You'd have to extend it
or add something similar for Copy and Paste. The ID for Copy is 19 and
Paste is 22.

''Pass True to Enable and False to Disable
Sub AllowCuts(EnableBool As Boolean)
Dim oCtls As CommandBarControls, oCtl As CommandBarControl
Set oCtls = CommandBars.FindControls(ID:=21) ''Cut
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 "^x"
.OnKey "+{Del}"
Else
.OnKey "^x", ""
.OnKey "+{Del}", ""
End If
End With
End Sub


--
Jim
"Adrian Turner" wrote in message
...
| Hi, I'm looking for some code to disable the cut,copy and paste buttons
| within the toolbar. I've foudn some for the menus, so I assume it is
similar.
| Struggling to find solution. If anyone has already done this, if you could
| point me in the right direction it will save me some frustration. Thanks


  #4   Report Post  
Posted to microsoft.public.excel.programming
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.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 118
Default Disabling Cut Copy and Paste buttons in toolbar

Hi Adrian,

I am wrting to check the status of the issue on your side. Would you mind
letting me know the result of the suggestions? If you need further
assistance, feel free to let me know. I will be more than happy to be of
assistance.

Have a great day!

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:
.

This posting is provided "AS IS" with no warranties, and confers no rights.
=================================================

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
Disabling copy/paste hidden cells Shawn Excel Worksheet Functions 2 May 15th 09 01:15 PM
Shortcuts for toolbar buttons/view code of toolbar buttons ericm[_2_] Excel Programming 1 July 23rd 07 09:00 PM
disabling the copy paste function in a cell sam Excel Worksheet Functions 0 February 22nd 06 02:10 PM
Disabling Toolbar Buttons with no open Workbook Paul Martin Excel Programming 1 October 28th 03 10:27 PM
Disabling Toolbar buttons and CommandBar items Jim[_20_] Excel Programming 2 August 14th 03 02:33 PM


All times are GMT +1. The time now is 07:16 PM.

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"