Does anyone know how to programmatically disable Application.xlcut

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have had some problems maintaining formula integrity within a customized Excel application that is distibuted to multiple users (~100) when a user cuts and pastes a cell into another location.

Often this is done accidentally with a quick right, then left mouse click (especially on a laptop); but to fix the problem I have to remote into the user's machine to realign the formulas!!

Does anyone know of a way to disable the cut function, and perhaps change the application mode to xlcopy?

What I need to know is how would you isolate and approach the action -- the sheet is not changed until after the paste -- where would you put the module?
 
Below are a few options or approaches to your problem.

1) Disable the DrapAndDrop property to eliminate your stated right-click /
left-click mouse problem.
Application.CellDragAndDrop = False

2) Intercept the mouse right-click and cancel it. The worksheet has a
predefined "BeforeRightClick" event that can be trapped (you can also use
WithEvents and a Class module to sink the "BeforeRightClick" event for the
entire workbook and Excel application).

Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As
Boolean)
'''Intercept and cancel the mouse right-click.
Cancel = True
End Sub

3) Cancel any pending "cut" when the user moves to a new cell. Once again,
this worksheet event can be applied across the entire Excel application by
sinking the events using a Class module and WithEvents.

Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
If Application.CutCopyMode = xlCut Then
Application.CutCopyMode = False
End If
End Sub

4) Use Worksheet protection to protect locked cells.

Troy


Fonda said:
I have had some problems maintaining formula integrity within a customized
Excel application that is distibuted to multiple users (~100) when a user
cuts and pastes a cell into another location.
Often this is done accidentally with a quick right, then left mouse click
(especially on a laptop); but to fix the problem I have to remote into the
user's machine to realign the formulas!!
Does anyone know of a way to disable the cut function, and perhaps change
the application mode to xlcopy?
What I need to know is how would you isolate and approach the action --
the sheet is not changed until after the paste -- where would you put the
module?
 
Back
Top