Posted to microsoft.public.excel.programming
|
|
Cannot seem to Cancel EXCEL App Right Click Event using C#
"AA2e72E" wrote:
I don't believe you can disable the right click on the activesheet. If you set the AllowPropertyToolbox to false, it disables the Property Toolbox on the right click menu. There is no other property that can be set. The list of properties is:
ActiveCell ActivePane ActiveSheet
AllowPropertyToolbox AutoFit BuildNumber
CSVData CSVURL CanUndo
Cells Columns Constants
DataType Dirty DisplayColHeaders
DisplayGridlines DisplayHorizontalScrollBar DisplayPropertyToolbox
DisplayRowHeaders DisplayTitleBar DisplayToolbar
DisplayVerticalScrollBar EnableAutoCalculate EnableEvents
EnableUndo HTMLData HTMLURL
MajorVersion MaxHeight MaxWidth
MinorVersion MoveAfterReturn MoveAfterReturnDirection
Range RevisionNumber RightToLeft
Rows ScreenUpdating Selection
TitleBar Version ViewableRange
I can't see that there is a right click event.The list of events is:
BeforeCommand Calculate CancelEdit
Change Click Command
DblClick EndEdit KeyDown
KeyPress KeyUp MouseDown
MouseOut MouseOver MouseUp
SelectionChange SelectionChanging StartEdit
ViewChange
Like you, I think the OWC PIA is screwed up. Can you help with my post "OWC Web Component Spreadsheet: C#" in this news group?
"Nick Biggs" wrote:
I am trying to use Excel from C# and need to disable the menu that appears when clicking the right mouse button on a cell.
I am trying to do this using the Excel.AppEvents_SheetBeforeRightClickEventHandler from my C# WinForm application.
I have a MessageBox that pops up that proves my event handler actually fires via my delegate but after setting the "Cancel" variable to "true" it has no effect for me. The Excel RMB menu appears when it should not. The Cancel parameter is declared as "ref bool".
I am wondering if there is a problem with the marshalling of this variable in the Office PIA which I am using. I would be happy to send code that demos my problem. Can someone please let me know if they can make it work ?
By the way I have already written some VB6 code that works fine and VBA code in an Excel Workbook that also works just fine as well. Both disable the menu as I require when I set "Cancel" to "True". The problem is that I need to do this from a C# application.
Can anyone shed some light on this at all ?
I am using...
Microsoft Excel 2002 (10.4302.4219) SP-2
Visual Studio 2003 v7.1.3088
Microsoft .NET Framework 1.1 v1.1.4322
I obtained the Office XP Primary Interop Assemblies from the following link
http://www.microsoft.com/downloads/d...displaylang=en
|