How to assign shortcut keys at the document level?

I am using shortcut keys to trigger macros on my Calc documents. For this, I use the [Tools > Customize > Keyboard] dialog box. There, I can only assign shortcut keys at the Calc level or at the LibreOffice level, not at the document level. In other words, if I assign Macro1 to [CTRL+SHIFT+M] for my Calc1.ods sheet, I cannot assign the same shortcut keys to Macro2 for my Calc2.ods sheet. If I try it, it overrides the previous setting.

Is there a way this can be done though?

Help would be much appreciated since using shortcut keys is a very convenient way to invoke macros when working on a document, specially for repetitive tasks. I often use it on my Calc documents and I can’t see myself having to remember the plethora of shortcut keys that would need to be assigned for each document (all the more so when they share somewhat the same structure and the macros perform similar tasks).

This can be done with a macro.

2 Likes

@jb13:
How should this be reasonable?
Shortcuts are intended to speed up work. To actually have an advantage, a user must be familiar with the shortcuts they use.

  • Changing them on the template level would confuse things and slow down work.
  • Sending a document with specific shortcut settings to a different user would even be dangerous. They may be accustomed to their settings for Calc where (e.g.) Ctrl+2 is used for something like"Insert 2 columns!". Your document understands the Ctrl+2 as “Delete 20 rows below”.
1 Like

Thanks sokol, this looks promising!

Thank you also Lupp, this gives a lot more context to the topic. This is worth knowing the limits and dangers of this approach. The bottom line is: if a document has more than one editor, document-level shortcut keys should not be used. In my case though, I have a set of personal documents where this would still make a lot of sense. So in this more limited scope, I like the solution proposed by sokol.

One such case is users who constantly work with forms of documents of a certain type. Suggestions for increasing productivity, in particular hot keys, are always accepted with enthusiasm.