Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Occurs when an XmlMappedRange control is right-clicked, before the default right-click action.
Namespace: Microsoft.Office.Tools.Excel
Assembly: Microsoft.Office.Tools.Excel (in Microsoft.Office.Tools.Excel.dll)
Syntax
'Declaration
Event BeforeRightClick As DocEvents_BeforeRightClickEventHandler
event DocEvents_BeforeRightClickEventHandler BeforeRightClick
Examples
The following code demonstrates a handler for the BeforeRightClick event that cancels the right-click action in an XmlMappedRange. The event handler informs the user that right-clicking is not allowed for the XmlMappedRange, and then sets the Cancel parameter of the DocEvents_BeforeRightClickEventHandler event handler to true so that Microsoft Office Excel cancels the right-click action. This code example assumes that the current worksheet contains an XmlMappedRange named CustomerLastNameCell.
Sub CustomerLastNameCell_BeforeRightClick(ByVal Target As Excel.Range, _
ByRef Cancel As Boolean) Handles CustomerLastNameCell.BeforeRightClick
MsgBox("Right-clicking in this range is not allowed.")
Cancel = True
End Sub
private void XmlMappedRange_BeforeRightClick()
{
this.CustomerLastNameCell.BeforeRightClick +=
new Excel.DocEvents_BeforeRightClickEventHandler(
CustomerLastNameCell_BeforeRightClick);
}
void CustomerLastNameCell_BeforeRightClick(Excel.Range Target,
ref bool Cancel)
{
MessageBox.Show("Right-clicking in this range " +
" is not allowed.");
Cancel = true;
}
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.