Home |
Search |
Today's Posts |
|
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Excel 2003 Context menu handle
Hi,
I want to hide context menu which appears when we right click on sheet tab(Excel 2003). This context menu allows us to insert/rename/ delete/... particular worksheet. To get handler of Excel application, i have written following code: Please assume that my excel sheet is opened on desktop whose caption is: "EXCELSHEET_TEST" ------------------------------------------------------------------------------------------------------------ HWND hwndExcelHandler = FindWindow(NULL, "EXCELSHEET_TEST"); ------------------------------------------------------------------------------------------------------------ This code successfully returns handle of excel application, but i want context menu handler(HWND), so that using context menu handle i can hide it. Thank you, Jaydeep |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
Excel 2003 Context menu handle
Hi,
I am developing this appliation in C++. So if i get Context menu handle(HWND) only, then using different Windows APIs like DeleteMenu, EnableMenu,.....i can hide/disable it. Is there any way to get handle of Context menu? Thank You, Jaydeep Dave Peterson wrote: You can disable that menu using regular old VBA: Option Explicit Sub auto_open() Application.CommandBars("Ply").Enabled = False End Sub Sub auto_close() Application.CommandBars("Ply").Enabled = True End Sub If macros are disabled, then this won't work. If the users know how to enable that commandbar, then it won't be secure. And since this is an application setting, it will affect all workbooks that are open. You may want to look at workbook events to disable/enable this menu only under certain conditions. Some references: David McRitchie's intro to macros: http://www.mvps.org/dmcritchie/excel/getstarted.htm You can read more about events at: Chip Pearson's site: http://www.cpearson.com/excel/events.htm David McRitchie's site: http://www.mvps.org/dmcritchie/excel/event.htm wrote: Hi, I want to hide context menu which appears when we right click on sheet tab(Excel 2003). This context menu allows us to insert/rename/ delete/... particular worksheet. To get handler of Excel application, i have written following code: Please assume that my excel sheet is opened on desktop whose caption is: "EXCELSHEET_TEST" ------------------------------------------------------------------------------------------------------------ HWND hwndExcelHandler = FindWindow(NULL, "EXCELSHEET_TEST"); ------------------------------------------------------------------------------------------------------------ This code successfully returns handle of excel application, but i want context menu handler(HWND), so that using context menu handle i can hide it. Thank you, Jaydeep -- Dave Peterson |
#4
Posted to microsoft.public.excel.misc
|
|||
|
|||
Excel 2003 Context menu handle
I don't speak C++.
Sorry. wrote: Hi, I am developing this appliation in C++. So if i get Context menu handle(HWND) only, then using different Windows APIs like DeleteMenu, EnableMenu,.....i can hide/disable it. Is there any way to get handle of Context menu? Thank You, Jaydeep Dave Peterson wrote: You can disable that menu using regular old VBA: Option Explicit Sub auto_open() Application.CommandBars("Ply").Enabled = False End Sub Sub auto_close() Application.CommandBars("Ply").Enabled = True End Sub If macros are disabled, then this won't work. If the users know how to enable that commandbar, then it won't be secure. And since this is an application setting, it will affect all workbooks that are open. You may want to look at workbook events to disable/enable this menu only under certain conditions. Some references: David McRitchie's intro to macros: http://www.mvps.org/dmcritchie/excel/getstarted.htm You can read more about events at: Chip Pearson's site: http://www.cpearson.com/excel/events.htm David McRitchie's site: http://www.mvps.org/dmcritchie/excel/event.htm wrote: Hi, I want to hide context menu which appears when we right click on sheet tab(Excel 2003). This context menu allows us to insert/rename/ delete/... particular worksheet. To get handler of Excel application, i have written following code: Please assume that my excel sheet is opened on desktop whose caption is: "EXCELSHEET_TEST" ------------------------------------------------------------------------------------------------------------ HWND hwndExcelHandler = FindWindow(NULL, "EXCELSHEET_TEST"); ------------------------------------------------------------------------------------------------------------ This code successfully returns handle of excel application, but i want context menu handler(HWND), so that using context menu handle i can hide it. Thank you, Jaydeep -- Dave Peterson -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Updating context menu in Excel | Excel Discussion (Misc queries) | |||
Add items to context menu | Excel Worksheet Functions | |||
Excel 2003 No Context Help | Excel Discussion (Misc queries) | |||
how can i place the Format Painter icon on the Context menu? | Excel Discussion (Misc queries) | |||
Excel VBA 2003 Help Menu | Excel Discussion (Misc queries) |