We have a workbook that we don't want given to unauthorized users. Each time anyone attempts to open the workbook, our code will check an online SQL table to make sure certain environmental variables (and company name) are equal to the approved values. If that test fails, we want the workbook first to display a message to the user and then NOT to open. Naturally, we don't want the user to be able to hit a key combination (such as Ctrl-Break) to interrupt the macro so that the workbook can be used.
Someone else is writing the code to check the online SQL table for approved values. I've tried putting my part of the code in the On Open event, but when my dialog box (using msgbox) displayed to inform the user that the security check failed, I was able to Ctrl-Break out of that code and right into Excel's debug/end dialog box and then into the very spreadsheet whose access was to be prohibited.
If it matters, I tested this before locking the VBA code. I will do so after finishing the code.
If more details are required, please ask. My preliminary code worked as planned (workbook never opened) as long as I didn't try to Ctrl-Break out of it. We want to make sure that this workbook cannot be used even if an unauthorized individual gets a hold of it.
If there are any other "gotchas", I'd appreciate being told about them.
Thanks as always!!!!
Mark
Someone else is writing the code to check the online SQL table for approved values. I've tried putting my part of the code in the On Open event, but when my dialog box (using msgbox) displayed to inform the user that the security check failed, I was able to Ctrl-Break out of that code and right into Excel's debug/end dialog box and then into the very spreadsheet whose access was to be prohibited.
If it matters, I tested this before locking the VBA code. I will do so after finishing the code.
If more details are required, please ask. My preliminary code worked as planned (workbook never opened) as long as I didn't try to Ctrl-Break out of it. We want to make sure that this workbook cannot be used even if an unauthorized individual gets a hold of it.
If there are any other "gotchas", I'd appreciate being told about them.
Thanks as always!!!!
Mark