Block VBE access

mweaver

Board Regular
Joined
Jul 28, 2002
Messages
129
Greetings From Salina, KS.

I am wanting to block VBE access to users on a small sample I am sending out. While I know this is close to impossible I am still wanting to make it as difficult as possible.

I am planning on using OZgrid's example to force users to accept macros to get to the workbook. I am going to add the following line, called from a Workbook_Open event, to close the VBE if it is already open.

Application.VBE.MainWindow.Visible = False


I am going to disable the shortcut keys use the OnKey method:

Application.OnKey "%{F11}", ""
Application.OnKey "%{F8}", ""

This effectively tells Excel to ignore the normal course of action for this combination of keys.

Also disable the menu option.

With Application.CommandBars("Tools").Controls
.Item("Macro").Enabled = False
End With

now I can only think of one way to get to VBE and that is right click on sheet tabs.


Is there simple code to disable the right click View Code menu item on ALL visible sheet tabs???




I am thinking all this MUST
be reversed on workbook close event!!


thanks

mweaver
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.

Ivan F Moala

MrExcel MVP
Joined
Feb 10, 2002
Messages
4,209
On 2002-09-07 13:29, mweaver wrote:
Greetings From Salina, KS.

I am wanting to block VBE access to users on a small sample I am sending out. While I know this is close to impossible I am still wanting to make it as difficult as possible.

I am planning on using OZgrid's example to force users to accept macros to get to the workbook. I am going to add the following line, called from a Workbook_Open event, to close the VBE if it is already open.

Application.VBE.MainWindow.Visible = False


I am going to disable the shortcut keys use the OnKey method:

Application.OnKey "%{F11}", ""
Application.OnKey "%{F8}", ""

This effectively tells Excel to ignore the normal course of action for this combination of keys.

Also disable the menu option.

With Application.CommandBars("Tools").Controls
.Item("Macro").Enabled = False
End With

now I can only think of one way to get to VBE and that is right click on sheet tabs.


Is there simple code to disable the right click View Code menu item on ALL visible sheet tabs???




I am thinking all this MUST
be reversed on workbook close event!!


thanks

mweaver

Hi mweaver
Lookup commandbar("Ply") and disable this.

Also

Disable double clicking on the commandbars
will also activate the customize menu so
disable this

Lookup Application.OnDoubleClick

All you need to do is Redirect the Action to
a Dummy macro
 
L

Legacy 98055

Guest
I see Ivan already gave you an answer but since I took the time to figure out what the popups name was, "Ply", this code will disable(grey out) View Code. Use the same code with TRUE when your workbook is closed or deactivated. What does "Ply" stand for?

Application.CommandBars("Ply").Controls("&View Code").Enabled = False

Tom
 

Forum statistics

Threads
1,144,510
Messages
5,724,777
Members
422,576
Latest member
kayth891

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
Top