Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Disable right click menu options in workbook

Status
Not open for further replies.

MISMonkey

MIS
Jun 11, 2003
32
GB
Ok - I have trawled the interweb to no avail on this one so once again I turn to you my friends...

Rightly or wrongly I want to disable ALL right click menu / pop up events when my workbook opens. Whilst there is a plethora of code and tips out there on how to do this at a cell, sheet, ply, row etc... level and even the old chestnut that is "BeforeRightClick" routine - non truely disable the right click option.

How do I know this? I have employed the above and still when you right click on the top menu bar you get the 'toolbars' to display options appearing. I don't want this.

I have a custom toolbar that gets created when the workbook opens and having this right click option would allow users to de-select this menu item and reinstate others. Any help wise ones would be appreciated.

I love deadlines. I like the whooshing sound they make as they fly by. (Douglas Adams)
 
I honestly don't think this is possible in Excel. It's just not built the way you're asking.

You would have to have a custom application... or depending upon what all you are doing, you could have more control in an Access database.

I could be wrong, could just be something I'm not aware of, but I don't think you'll be able to get the control you're looking for in Excel.
 
I don't have a solution for you, but there might be a lifeline.

It might not be possible using Excel per se, but might it be possible via the API? I'm thinking you could perhaps intercept the call to the application itself and handle that directly.

To be honest I always find this kind of stuff to be fairly murky waters. It is the kind of thing strongm is much better at. If you feel like investigating, search on "sub classing".

I doubt I'll have the time to play with it over the weekend, but if I do, I'll get back to you.

Good luck,

Tony

 
thanks Tony & kjv. I will continue to trial things and take a look at he api calls idea. just to be clear - I have already disabled all toolbars, created a custom toolbar on the fly with the buttons on it I want and displayed it, turned off the exel file menu ( file, edit etc...), removed the formula bars, tabs, columns and rows. In effect it is just a screen with my custom toolbar on. given ALL this is do-able I would be surprised if the last available right click option still working couldn't be turned off... but then this is Microsoft! I would have naturally done this in a db if that was an option but this is a company with just excel users and no access installed :(.

I love deadlines. I like the whooshing sound they make as they fly by. (Douglas Adams)
 

If you take all of the functionality out from Excel, it is not Excel any more. So what do you give your users instead? What can the do with your ‘custom toolbar on’?

Maybe the answer would be to create something useful in VB6 (I know – old, but still very useful) or VB.NET (some versions are free) with some grids, menus, toolbars, and such? Then you are in full control of how it works and you don’t have to close all the doors and provide just a small window for Users

Just my $0.02


Have fun.

---- Andy
 
Andy - totally agree but then again we sometimes have to work with what we've got and in this case it is a paranoid company with limited resources and even more limited talent. The sum total of all this is to create apps that are totally foolproof - hence my query. for anyone reading this feel free to point out more of thet obvious but it would be more helpful if a SOLUTION was forthcoming (if there is one). I'll be in the US next week for a month so maybe the sunshine will get the creative juices flowing!


I love deadlines. I like the whooshing sound they make as they fly by. (Douglas Adams)
 


I agree with Andy!!!

Tell you boss with limited resources that he's attempting to use the WRONG TOOL for the job.

It would be like taking a table saw and cutting the blade height adjustment wheel off and welding the fence to the bed!

REALLY STUPID IDEA!

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
this thread is starting to sound like therapy - people seem to be venting! well it's good to get it off your chest and move on. let me be clear - it is a REALLY stupid idea. I agree with ALL your comments but it doesn't negate the fact that this is a customer requirement and whilst the customer doesn't always know what's best for them they still remain the paying customer (and this is a customer with circa 10k+ staff so not inconsiderable!). if it were my company I would give the users the best tools for the job no doubt about it! keep the input coming guys - thanks

I love deadlines. I like the whooshing sound they make as they fly by. (Douglas Adams)
 
Wait, you said:
(and this is a customer with circa 10k+ staff so not inconsiderable!).

Then how in the world are their resources so limited that they cannot do VB6 or .NET?

If you can't do the job for them, but they can spend the money elsewhere to get the job done, frankly it would look better for you to tell them that you can help them find someone who can do the job.

Just make sure you're not hurting your employer/customer/whatever the situation is because you want to provide job security to yourself.

Sorry, but that's what this whole thing sounds like to me. Either teach/show the customer/employer to use Excel or else build the app they need or help find someone who can.
 
Just to be clear - right-clicking is a feature of the OS. This is why it is difficult to eliminate completely in an application.
 
strongm, you said:
right-clicking ...is difficult to eliminate completely in an application

But is it not possible to intercept it, rather than eliminate it? I'd certainly bow to your experience in these realms, but I think you've previously suggested quite a few solutions involving subclassing. Could that not work here?

Tony
 
First of all - I agree that it's a bad practice to lock most of excel functionality, in this case they should choose another application.

Excel offers some possibilites to block user's actions:
- intercept right-click sheet's events (Workbook_SheetBeforeRightClick, Worksheet_BeforeRightClick),
- protect workbook's structure (no sheet's adding),
- protect custom toolbars (no customise),
- protect other toolbars (NoChangeVisible),
- protect vba project (no access to code pane),
- hide unnecessary worksheets (xlVeryHidden),
- password-protect worksheets (set UserInterfaceOnly to True),
- work with userforms, hide excel.

combo
 
>I think you've previously suggested quite a few solutions involving subclassing

I've suggested some solutions to specific, limited issues. And I wouldn't really recommend subclassing in VBA ... And then there there are the keyboard shortcuts (for example Alt-V Alt-T, or Alt-T Alt-C will both provide access the GUI for changing the commandbars displayed by Excel 2003)
 
Fair enough. I hadn't thought of that.

It sounds like the OP is back at "you shouldn't be trying to do that in the first place" then.

Tony
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top