ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Protects running from VBA, but not from hot key (https://www.excelbanter.com/excel-programming/403694-protects-running-vba-but-not-hot-key.html)

Andyjim

Protects running from VBA, but not from hot key
 

Macro protects workbook as its last command. It works when I run the macro
from VBA. But when I run the same macro from a hot key, it runs without error
but the workbook is not protected. I'm stumped.

Barb Reinhardt

Protects running from VBA, but not from hot key
 
Please post your code and maybe we can help.
--
HTH,
Barb Reinhardt



"Andyjim" wrote:


Macro protects workbook as its last command. It works when I run the macro
from VBA. But when I run the same macro from a hot key, it runs without error
but the workbook is not protected. I'm stumped.


Dave Peterson

Protects running from VBA, but not from hot key
 
Any chance that you open another workbook in your macro?

And does your hotkey include the shift key?

If yes to both, then remove the shift key from the hot key.

If you open a workbook with the shift key held down, then excel thinks you don't
want to run the auto_open or workbook_open procedures.

And since your shortcut key includes the shift key, it's confusing excel and
excel thinks you want to stop.

Andyjim wrote:

Macro protects workbook as its last command. It works when I run the macro
from VBA. But when I run the same macro from a hot key, it runs without error
but the workbook is not protected. I'm stumped.


--

Dave Peterson


All times are GMT +1. The time now is 11:50 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com