![]() |
disabling CUT function
hi guys,
my workmates are cutting in a spreedsheet and removing borders etc. how can i stop the cut function. regards keef |
ere's some code that does the trick, along with disabling drag and down and
the ability to turn D&D back on. Sub DisableCuts() 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 = False Next End If Set oCtls = CommandBars.FindControls(ID:=522) ''Options If Not oCtls Is Nothing Then For Each oCtl In oCtls oCtl.Enabled = False Next End If With Application .OnKey "^x", "" .OnKey "+{Del}", "" .CellDragAndDrop = False End With End Sub Sub EnableCuts() Dim oCtls As CommandBarControls, oCtl As CommandBarControl Set oCtls = CommandBars.FindControls(ID:=21) If Not oCtls Is Nothing Then For Each oCtl In oCtls oCtl.Enabled = True Next End If Set oCtls = CommandBars.FindControls(ID:=522) If Not oCtls Is Nothing Then For Each oCtl In oCtls oCtl.Enabled = True Next End If With Application .OnKey "^x" .OnKey "+{Del}" .CellDragAndDrop = True End With End Sub -- Jim Rech Excel MVP "Keef" wrote in message ... | hi guys, | my workmates are cutting in a spreedsheet and removing borders | etc. how can i stop the cut function. | | regards | keef | | |
hi jim,
thanks for your reply, i can't seem to get this working.. no errors are showing but i can still cut also regards keef "Jim Rech" wrote in message ... ere's some code that does the trick, along with disabling drag and down and the ability to turn D&D back on. Sub DisableCuts() 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 = False Next End If Set oCtls = CommandBars.FindControls(ID:=522) ''Options If Not oCtls Is Nothing Then For Each oCtl In oCtls oCtl.Enabled = False Next End If With Application .OnKey "^x", "" .OnKey "+{Del}", "" .CellDragAndDrop = False End With End Sub Sub EnableCuts() Dim oCtls As CommandBarControls, oCtl As CommandBarControl Set oCtls = CommandBars.FindControls(ID:=21) If Not oCtls Is Nothing Then For Each oCtl In oCtls oCtl.Enabled = True Next End If Set oCtls = CommandBars.FindControls(ID:=522) If Not oCtls Is Nothing Then For Each oCtl In oCtls oCtl.Enabled = True Next End If With Application .OnKey "^x" .OnKey "+{Del}" .CellDragAndDrop = True End With End Sub -- Jim Rech Excel MVP "Keef" wrote in message ... | hi guys, | my workmates are cutting in a spreedsheet and removing borders | etc. how can i stop the cut function. | | regards | keef | | |
All times are GMT +1. The time now is 06:34 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com