I don't really understand what you mean. Are you trying to stop users from starting a macro that you have in another Doc or in the same doc? What is the macro for? Why do you what to disable it anyway?
I need specifics to try to give you the best option possible.
If you can't be "The Best", be the best at what you can!!!
I have a macro, macro1, who starts when a user clicks "ctrl + 1". And I have another macro, macro4, who starts when a user clicks "ctrl + 4". If the user press "ctrl +1" I want macro1 to prevent the user from starting macro4 if he press "ctrl +4".
So I guess I can do this in two ways:
1: Write some code in macro1 that disables macro4.
2: Write some code in macro1 that disables the combination of the keys "ctrl + 4"
The macros insert a special heading for a word template.
So heading1 = "ctrl +1", heading2 = "ctrl +2", heading3 = "ctrl+3" heading4 = "ctrl+4" etc.
The goal of this project is to prevent a user inserting for example heading4 right after heading1.
I found some code for option 2: but it still don't work with the numeric keys. It's supposed to disable "ctrl+4"
Specifically, to disable (or do anything else to) the 4 key you need to use wdKey4 (value 52) as you have done. To disable (or do anything else to) the Nemeric Keypad 4 key you need to use wdKeyNumeric4 (value 100). More generally, see Thread68-599869 for how to disable/enable keys in both Word and Excel.
Disabling the key combination(s), of course, does not disable the macro. If you want to do that you will have to code it yourslef via global variables or similar.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.