View Single Post
 
Old 03-17-2024, 12:10 PM
Charles Kenyon Charles Kenyon is offline Windows 11 Office 2021
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 9,157
Charles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant future
Default

You certainly can store macros and hotkeys both in documents.

If your macros are in your documents and you store your hotkey globally but the macro is in the same module with the same name in each document, the hotkey should trigger the macro in the document rather than a globally stored macro.
See:
If you use a global template for the shortcut, there should be a macro stored in the global template that will respond to it if there is not a macro in the document.


If I were doing this, though, I would not put a separate macro in each document, but rather use a document variable in the document and have a central macro that performs the action and varies according to the presence and value of that variable.

Chris Woodman's Keyboard Shortcut Organizer contains a utility to let you read, set, and modify document variables from within the user interface, without going to the vba editor. Chris Woodman's Keyboard Shortcut Organizer
Reply With Quote