#1   Report Post  
Posted to microsoft.public.excel.misc
sparx
 
Posts: n/a
Default Disable "Cut" only


Can anybody help, I have been looking for some VBA code that will
disable just the CUT feature of excel - allowing all other functions
like COPY & PASTE still to work as normal. Several codes I have found
disables the CUT, and also disables the COPY & PASTE from working as
well. Does anybody know of some VBA that will also stop only the CUT
used either from the keyboard CTRL+X, or from menu's in the toolbar.
Thanks


--
sparx
------------------------------------------------------------------------
sparx's Profile: http://www.excelforum.com/member.php...o&userid=16787
View this thread: http://www.excelforum.com/showthread...hreadid=536703

  #2   Report Post  
Posted to microsoft.public.excel.misc
Delordson Kallon
 
Posts: n/a
Default Disable "Cut" only

try

http://www.ozgrid.com/VBA/disable-cut-copy.htm

Delordson Kallon
http://www.instantsoftwaretraining.com/

"sparx" wrote:


Can anybody help, I have been looking for some VBA code that will
disable just the CUT feature of excel - allowing all other functions
like COPY & PASTE still to work as normal. Several codes I have found
disables the CUT, and also disables the COPY & PASTE from working as
well. Does anybody know of some VBA that will also stop only the CUT
used either from the keyboard CTRL+X, or from menu's in the toolbar.
Thanks


--
sparx
------------------------------------------------------------------------
sparx's Profile: http://www.excelforum.com/member.php...o&userid=16787
View this thread: http://www.excelforum.com/showthread...hreadid=536703


  #3   Report Post  
Posted to microsoft.public.excel.misc
sparx
 
Posts: n/a
Default Disable "Cut" only


Thanks for your direction - I have tried those sites and they provide
VBA that stops all the copy, cut, paste etc working, I only want to
stop the CUT from working by either keyboard shortcut or menu options -
I did though find this code and altered it and it did sort of work but
not properly - so can anybody help with the following -

-- Worksheet_Activate Event --

Sub DisableCutCopy()
On Error Resume Next
With Application
'disables shortcut keys
.OnKey "^c", ""
.OnKey "^v", ""
.OnKey "^x", ""
'Disables Copy
.CommandBars("Edit").FindControl(Id:=19).Enabled = False
.CommandBars("Edit").FindControl(Id:=848).Enabled = False
.CommandBars("Cell").FindControl(Id:=19).Enabled = False
.CommandBars("Column").FindControl(Id:=19).Enabled = False
.CommandBars("Row").FindControl(Id:=19).Enabled = False
.CommandBars("Button").FindControl(Id:=19).Enabled = False
.CommandBars("Formula Bar").FindControl(Id:=19).Enabled = False
.CommandBars("Worksheet Menu Bar").FindControl(Id:=19).Enabled =
False
.CommandBars("Standard").FindControl(Id:=19).Enabl ed = False
.CommandBars("Button").FindControl(Id:=848).Enable d = False
.CommandBars("Formula Bar").FindControl(Id:=848).Enabled = False
.CommandBars("Worksheet Menu Bar").FindControl(Id:=848).Enabled =
False
.CommandBars("Standard").FindControl(Id:=848).Enab led = False
.CommandBars("Ply").FindControl(Id:=848).Enabled = False
'Disables Cut
.CommandBars("Edit").FindControl(Id:=21).Enabled = False
.CommandBars("Cell").FindControl(Id:=21).Enabled = False
.CommandBars("Column").FindControl(Id:=21).Enabled = False
.CommandBars("Row").FindControl(Id:=21).Enabled = False
.CommandBars("Button").FindControl(Id:=21).Enabled = False
.CommandBars("Formula Bar").FindControl(Id:=21).Enabled = False
.CommandBars("Worksheet Menu Bar").FindControl(Id:=21).Enabled =
False
.CommandBars("Standard").FindControl(Id:=21).Enabl ed = False
End With
End Sub

-- Worksheet_Deactivate Event --

Sub EnableCutCopy()
On Error Resume Next
With Application
.OnKey "^c"
.OnKey "^v"
.OnKey "^x"
'Enables Copy
.CommandBars("Edit").FindControl(Id:=19).Enabled = True
.CommandBars("Edit").FindControl(Id:=848).Enabled = True
.CommandBars("Cell").FindControl(Id:=19).Enabled = True
.CommandBars("Column").FindControl(Id:=19).Enabled = True
.CommandBars("Row").FindControl(Id:=19).Enabled = True
.CommandBars("Button").FindControl(Id:=19).Enabled = True
.CommandBars("Formula Bar").FindControl(Id:=19).Enabled = True
.CommandBars("Worksheet Menu Bar").FindControl(Id:=19).Enabled =
True
.CommandBars("Standard").FindControl(Id:=19).Enabl ed = True
.CommandBars("Button").FindControl(Id:=848).Enable d = True
.CommandBars("Formula Bar").FindControl(Id:=848).Enabled = True
.CommandBars("Worksheet Menu Bar").FindControl(Id:=848).Enabled =
True
.CommandBars("Standard").FindControl(Id:=848).Enab led = True
.CommandBars("Ply").FindControl(Id:=848).Enabled = True
' Enables Cut
.CommandBars("Edit").FindControl(Id:=21).Enabled = True
.CommandBars("Cell").FindControl(Id:=21).Enabled = True
.CommandBars("Column").FindControl(Id:=21).Enabled = True
.CommandBars("Row").FindControl(Id:=21).Enabled = True
.CommandBars("Button").FindControl(Id:=21).Enabled = True
.CommandBars("Formula Bar").FindControl(Id:=21).Enabled = True
.CommandBars("Worksheet Menu Bar").FindControl(Id:=21).Enabled =
True
.CommandBars("Standard").FindControl(Id:=21).Enabl ed = True
End With
End Sub

I removed all the code that didnt relate to the CUT option ( I believe
is 21 ) and put this into the "ThisWorkbook" of an Excel file - but for
some reason it still let me cut - where am I going wrong?


--
sparx
------------------------------------------------------------------------
sparx's Profile: http://www.excelforum.com/member.php...o&userid=16787
View this thread: http://www.excelforum.com/showthread...hreadid=536703

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
Disable Query Refresh warning dialog box in Excel 2003 Jeff Koons Excel Discussion (Misc queries) 2 December 1st 05 04:08 PM
Disable Customize toolber tabs areddy Excel Discussion (Misc queries) 1 October 21st 05 02:43 PM
Disable resize Waterfall chart Tim Charts and Charting in Excel 4 October 4th 05 10:46 PM
allow user to disable annoying warning dialog on log charts Roger Charts and Charting in Excel 3 September 13th 05 01:26 PM
Disable Adding & Deleting Rows/Columns Playa Excel Discussion (Misc queries) 1 February 3rd 05 03:42 PM


All times are GMT +1. The time now is 05:48 PM.

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

About Us

"It's about Microsoft Excel"