|
#1
|
|||
|
|||
Problems with KeyBindings.Add when closing Word
Good evening,
In the AutoNew() procedure of a dotm template, I change a Word keyboard shortcut by calling a macro, by the following lines: CustomizationContext = ActiveDocument.AttachedTemplate ' (it's about the same problem with Application.NormalTemplate) ActiveDocument.AttachedTemplate.Saved = True KeyBindings.Add KeyCategory:=wdKeyCategoryMacro, Command:="M1_TC.M1_TC_Ctrl_S", KeyCode:=BuildKeyCode(wdKeyControl, wdKeyS) In fact, I want the user to save the current document through my save procedure and not through the one proposed by default by Word. The shortcut works well, but as soon as the user exits Word, the application asks him to save the changes made to the template, which I do not want. I want the user to exit Word without having this message, and that no modification is saved neither in the custom dotm (ActiveDocument.AttachedTemplate), nor in the Normal.dotm Template (Application.NormalTemplate). For that, in the AutoClose() procedure I tried a lot of things without finding a real success. Here are the lines I tried a bit in all directions, commented or not : CustomizationContext = NormalTemplateKeyBindings.ClearAll Application.NormalTemplate.Saved = True ActiveDocument.Saved = True KeyBindings.ClearAll ThisDocument.Close (wdDoNotSaveChanges) Application.ActiveDocument.Close (wdDoNotSaveChanges) Application.NormalTemplate.AutoSaveOn = False Has anyone encountered this difficulty and/or could help me? Sincerely, David Translated with www.DeepL.com/Translator (free version) |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Need Help With How To Use KeyBindings | PosseJohn | Word VBA | 6 | 12-06-2013 02:23 PM |
Closing Word files | Humptydingo | Word | 5 | 09-07-2013 10:17 AM |
KeyBindings in PowerPoint? | tinfanide | PowerPoint | 1 | 03-16-2013 10:13 AM |
Word crashes when closing | mbjackson | Word | 1 | 02-06-2010 01:01 AM |
Problems closing Word 2007 and editing .doc files | sinjin | Word | 1 | 04-07-2009 09:09 AM |