disable new sheet insertion

F0RE5T

Board Regular
Joined
Nov 4, 2014
Messages
204
Hi

in the Private sub for when a workbook opens I include the following code:

'developers tab
Application.ShowDevTools = False
'hide ribbon
Application.ExecuteExcel4Macro "SHOW.TOOLBAR(""Ribbon"",False)"
'.................
'Hide formula bar
Application.DisplayFormulaBar = False
'..................
'max screen
Application.WindowState = xlMaximized
'..................
'do not show file history
Application.DisplayRecentFiles = False
'............................

The application I have built is driven from a sheet I use as a menu and the above disables certain user activity / views.

However during testing I have found that a user can right click on the "menu" sheet and still have access to the "insert" option. Though selection of this will not insert a sheet the application hangs and I cannot find a way to disable the "right click", not show "insert" or msgbox a msg to say don't .....

Can anyone help please?

many thanks
F0re5t

:confused:
 
You can even do it within your code...

ActiveWorkbook.Protect "PasswordGoesHere", True, False
 
Upvote 0

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
If the user is going to go to those lengths (hunting down the key combo that you found) to avoid using a spreadsheet the way its designed, does that say something about its design?

hi

why does it? I am sure we both come up with ideas to do something adhoc. most users know about the key function.
Not being rude as I like replies but your logic fails in the case for passwords doesn't it as most users can search for the hack.

take care
Fore5t
 
Upvote 0
Why would you have to 'redo' everything

We're only talking about 1 small part of your overall objective.
The ability to insert sheets is not related to all the other things you've disabled..(formulabar, windowstate, showrecentfiles,etc...)
None of that woulud have to be 'redone'

Sometimes the simple solution really is the best solution.

The functionality to prevent users from inserting sheets already exists within the Excel Program as provided by MS.
Why Re-Invent another method to accomplish the same task?

Hi

I agree with keeping things simple but as I mentioned I like to learn new ways for future concepts as well
I do not like hard coding passwords which may have been the case because of the desired requirements in other functionality.

Thank you for your advice though.

f0re5t
 
Upvote 0
You don't have to 'hard code' the password into the code..
You could do
Code:
pswd = InputBox("Enter A Password")
ActiveWorkbook.Protect pswd, True, False

Also, The password is completely optional. You can set it as ""
And Doing the proteciton with code is optional too.
Do it by hand, and save the book.

Most users don't even know about workbook protection, they only know about sheet protection.
And those that do, can probably circumvent passwords (and all the other stuff you're securing) anyway.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,216,082
Messages
6,128,713
Members
449,464
Latest member
againofsoul

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top