Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 4
Default 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

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Excel 2003 Context menu handle

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
  #3   Report Post  
Posted to microsoft.public.excel.misc
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


  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Updating context menu in Excel Tim879 Excel Discussion (Misc queries) 0 February 28th 07 08:42 PM
Add items to context menu Fred Jacobowitz Excel Worksheet Functions 1 April 22nd 06 10:29 PM
Excel 2003 No Context Help Newsgoups Excel Discussion (Misc queries) 0 November 2nd 05 12:19 PM
how can i place the Format Painter icon on the Context menu? Saratusthra Excel Discussion (Misc queries) 2 June 8th 05 05:20 PM
Excel VBA 2003 Help Menu BareBamboo Excel Discussion (Misc queries) 0 April 1st 05 09:39 PM


All times are GMT +1. The time now is 08:37 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"