Protects running from VBA, but not from hot key

A

Andyjim

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.
 
D

Dave Peterson

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top