Prevent VBE from opening

Whisperer14

Well-known Member
Joined
Nov 6, 2002
Messages
589
I am aware that password *******s can render the password protection of VBA code ineffective.

The only way that I can think of getting around the problem is to prevent the VBE opening from either the Alt+F11 or the 'View Code' options.

Any idea would be most welcome, even if it is a 'No, it cannot be done' in which case I shall have to learn VB or Delphi :biggrin:.
(y)
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"

Cbrine

Well-known Member
Joined
Dec 2, 2003
Messages
3,196
There is no foolproof way to do it. This code will disable most options, but the right click on the worksheets tabs allows you to still enter the VBE. Of course the user has to press the enable macro's option to let the code run.


Application.CommandBars("Visual BaSIC").Enabled = False
Application.CommandBars.DisableCustomize = True
Application.OnKey "%{F11}", ""
 

Whisperer14

Well-known Member
Joined
Nov 6, 2002
Messages
589
Thanks Cbrine, I have used just the last of the 3 options, setting Fll to "", how do I restore it to open the VBE please?
 

Cbrine

Well-known Member
Joined
Dec 2, 2003
Messages
3,196
Well, for the part you need to send a cheque. :biggrin:

Just kidding.

Application.OnKey "%{F11}"

Cal
 

Whisperer14

Well-known Member
Joined
Nov 6, 2002
Messages
589
Dave,

What a nightmare situation!

Thank you for the link, your solution was very interesting but it begs a question. If the master file is closed then the safeguards are negated, is there a way of ensuring that it is not visible in the Taskbar and automatically closed when the opened program is closed?
TIA
Gordon (y)
 

NdNoviceHlp

Well-known Member
Joined
Nov 9, 2002
Messages
2,911
At the risk of being censored again, I will provide some suggestions and not evil code. Assuming that the "master" file is your actual program that you want protected, if you make the calling program an addin on workbook closed and the "master" program not an addin on workbook open, the result is that only the "master" program will be in the taskbar and you will not have access to the VBA editor. Sorry I can't be more specific. Hope this helps. Dave
 

Forum statistics

Threads
1,148,272
Messages
5,745,790
Members
423,973
Latest member
man_this_is_hard

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