public static bool RemoveAssignedKey(Application wordApp, Hotkey hotkey, string macroCommand) { int count = wordApp.KeyBindings.Count; for (int i = count; i >= 1; i--) { KeyBinding curKeyBinding = wordApp.KeyBindings[i]; if (curKeyBinding.KeyCode == GetKeyCodeFromString(wordApp, hotkey.ToString())) //if (curKeyBinding.Command == macroCommand) { try { curKeyBinding.Disable(); return(true); } catch { return(false); } } } return(false); }