VBA CODE IF YOU CLICK VISUAL BASIC EDITOR

Dear Nick,

Good day.

I made a vba project with password protection for our company use but one of my officemates opened/viewed my vba codes in each sheets, modules, userform even I click locked project for viewing with password.
He is using hex editor to cracked and opened the password protected vba project.

In this connection, may I ask if there is an event vba code when you click the visual basic editor button/icon or Alt F11?

I had made already a vba password protected userform. My problem is I don't know the event VBA code if you click the visual basic editor button or ALT F11 as i mentioned earlier.

I had developed already an event VBA code when you open excel file and password protected userform will show with a VBA code looks like this below:

Private Sub Workbook_Open()
Userform1.Show
End sub

Now my concern, is there an Event VBA code if you click the visual basic editor icon or Alt F11 then my created Userform will show or pop up?

Your soonest reply is highly appreciated. God bless.

yours truly,

Leo

Nick's picture

hi Leo to answer your

hi Leo

to answer your question:

Application.OnKey "%{F11}", ""
will disable.

Application.OnKey "%{F11}"
will return to normal meaning

- note that you want to take care that you don't disable it for yourself as well

however, there's nothing to stop the user going through the tools menu unless you disable that too.

There's a broader point raised here, in that the user of the system is doing something undesirable. Suggest firstly having a word with them, then raising with their manager. Also good to do is to contact Human Resources of your company, and ensure that the culture is in place to make people aware that if something is password protected, it's that way for a reason, and that they should not go around trying to break it.

Nick

VBA click event if you click Visual Basic Editor icon/button

Dear Nick,

Thank you for your reply. you had addressed the ALT F11 that will disable applicaion.keys.

How about the VBA right-click mouse event when you click the Visual Basic Editor icon/button then VBE window will launch and the Userform will show just like an event when:
sub workbook_open()
userform1.show
end sub

Hope you can answer my query the soonest possible time.

Leo

Nick's picture

hi Leo Whatever you do, there

hi Leo

Whatever you do, there will always be a way to break it.. there's no secure way of hiding the VBA code that I know of.

If security is a serious consideration, you'll need to go down the xll route...

Rgds
Nick