Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() "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 |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I think you're speaking the Greek here!
But I can disable the rightclick option on a worksheet by disabling the "Cell" commandbar. Maybe it'll work for you: Dim myIndex As Long myIndex = Application.CommandBars("cell").Index Application.CommandBars(myIndex).Enabled = False Application.CommandBars(myIndex + 3).Enabled = False The +3 refers to the "cell" commandbar when you're in View|PageBreak Preview mode. (Don't forget to turn it back to True when you're done. This setting will be kept the next time excel opens!) 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 -- Dave Peterson |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() "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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Cancel sheet change event | Charts and Charting in Excel | |||
On Click Event?, and how to use | Excel Programming | |||
Cancel terminate event?? | Excel Programming | |||
Before Right Click event | Excel Programming | |||
Click Event | Excel Programming |