Code triggers if someone opens a specific workbook

Xenta

New Member
Joined
Jul 1, 2022
Messages
3
Office Version
  1. 365
  2. 2021
  3. 2019
Platform
  1. Windows
Heya, how do you trigger the code on how to see if someone opens a vba on that workbook?
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
What specifically do you mean by "opens a vba on that workbook"? Do you mean if they open the macro code development window? Run a macro? Something else?
 
Upvote 0
What specifically do you mean by "opens a vba on that workbook"? Do you mean if they open the macro code development window? Run a macro? Something else?
Sorry for the late reply.
yes, if they try to view the code for the macros in that workbook. I tried putting a password but I saw some macros that are able to remove the VBA's password, so I was planning on making a code that would close the excel if someone else tried to view the codes.
 
Upvote 0
First, I know of no way to cause VBA code to run if someone opens the VBA development window. I'm not going to tell you it's impossible, but I have no idea how you could do that.

Second, it sounds like you are trying to put some sort of security on the code. Excel is notoriously weak when it comes to security. The security is generally good for compliant users but not malicious users. In your case, even if you could create code to close the workbook, the user has to simply disable macros and then your code won't run.

You may need to consider other options, like a commercial Excel compiler that will bundle your Excel file into a format where the code cannot be read.
 
Upvote 0
First, I know of no way to cause VBA code to run if someone opens the VBA development window. I'm not going to tell you it's impossible, but I have no idea how you could do that.

Second, it sounds like you are trying to put some sort of security on the code. Excel is notoriously weak when it comes to security. The security is generally good for compliant users but not malicious users. In your case, even if you could create code to close the workbook, the user has to simply disable macros and then your code won't run.

You may need to consider other options, like a commercial Excel compiler that will bundle your Excel file into a format where the code cannot be read.
I see, thanks for the suggestion
 
Upvote 0

Forum statistics

Threads
1,223,888
Messages
6,175,207
Members
452,618
Latest member
Tam84

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