View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
[email protected] chovatia.jaydeep@gmail.com is offline
external usenet poster
 
Posts: 4
Default 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