toggle macros assigned to key in Word 365
I have several macro enabled templates. They are constructed from a file created from another application and have variable text. They also have consistent sets of brackets containing varying text in brackets, depending the the requirement of the template. For example:
template 1.dotm: abc [def] ghi. [JKL] mno [pqr]
template 2.dotm: 123abc [def456] ghi789. [222JKL] 345mno [And so on and so forth pqr]
They all have 6 custom macros, each one is assigned to a different number keypad key (end, arrow down, pgdn etc.). These keys were picked for rapid editing through the documents. The macros are:
1. select next set of brackets in the document - - assigned to numeric keypad end key
2. edit selected text by removing brackets surrounding selected text then calling macro 1 - - assigned to numeric keypad down arrow key
3. deleting the text along with the brackets then calling macro 1 - - assigned to pgdwn key
4. remove a line completely
5. and 6. other similar fast editing macros
7. assign the macro to the 6 keys
8. toggle back to the default function of the 36
Sometimes I need to revert to the default function to use the number keypad keys as designed (default Word actions), then immediately reassign the keys to the macros.
I have tried many code variants, including user forms, to accomplish this. I have also tried assigning the macros to shft+ctl+m to enable the end, arrow down, pgdn etc keys and shft+ctl+b keys to return them to default action. No matter how I go about it I have not succeded. On occasion, the code I've tried is long, even though it should be relatively simple. I normally include the code in a combined module but have tried separating the functions into separate modules. I've also tried enabling and disabling the keys with Autohotkey with and without vbs files to run the macros.
Nothing I have tried works. Any suggestions are appreciated. savvy
|