I'm releasing some of workbooks onto some people to test. I have a procedure that deletes the workbook, but I'd like to run this as soon as the VBE is opened. What coding do I use and where should I place it?
Many thanks,
Dom
I'm releasing some of workbooks onto some people to test. I have a procedure that deletes the workbook, but I'd like to run this as soon as the VBE is opened. What coding do I use and where should I place it?
Many thanks,
Dom
Hi, welcome to VBAX!! Put the code in the Workbook Open event. To find that, open the VBE and click on the top left and change to Workbook. Then on the right change to open. The code goes in there.
Thanks for the quick reply.
Would this be everytime the workbook opened or everytime the VBE opened? I'd like it to only be when the visual basic editor window was opened. Cheers,
Dom
Cheers
Oh, that puts a different twist on it. Not sure if it can be done or not. If it can you can bet someone here can help you. I dont know for sure.
Point of clarification. You want to delete the whole workbook or just the code? I would assume the code.
See if this KB entry helps you. I could be modified to do what you wish.
http://www.vbaexpress.com/kb/getarticle.php?kb_id=511
Either delete all the coding / UF's etc...
or delete the entire workbook.
I have a procedure that deletes the workbook, I just need a place to call it.
Ideally it would be in activation of the VBE, but can't figure out how to get this.
Thanks again
Why would it be the activation of the VBIDE? In normal workbook processing, it wouldn't be opened at all. In what circumstances would you be activating it?
Well i want them to use the workbook, just not access the coding! So on activation of the vba window it would run a procedure that would shut it down.
Dom
I have an excel workbook that I send out every month to our customers. To protect the knowledge behind it, I just lock it for viewing in VBE by going to properties of the project in VBE and then to the Protection tab and lock for viewing and put in a password (a very long password). In addition I put a timer in it so that the tool locks out every 45 days so that it can not be accessed.
You're wasting your time trying to provide fool-proof security in VBA, there's just too many ways to get around it.
However, maybe you'd like to try modifying this to suit, it uses the On-Time method to check if the VBE window's open/unlocked and then deletes all VBA code if a hidden password isn't there, but you'd really need to modify it so it's used in an add-in to maybe have some chance of success...
Note that you can only ever provide some extra levels of protection, but don't make the mistake of thinking "protection" is "security" - it is not. Excel VBA is not a secure environment
You know you're really in trouble when the light at the end of the tunnel turns out to be the headlight of a train hurtling towards you
The major part of getting the right answer lies in asking the right question...
Made your code more readable, use VBA tags (this automatically inserts [vba] at the start of your code, and [/vba ] at the end of your code) | Help those helping you by marking your thread solved when it is.