From: Christopher Rath Date: Mar 3 1998, 4:00 am Subject: ANNOUCE: VBAcs, VBA macros to enable Emacs shortcut keys in MSWord To: comp.lang.basic.visual.misc Place the followingmacrosin a Production module of anMSWord document that resides in your Startup folder. Follow-ups are set to `comp.lang.basic.visual.misc'. Enjoy, Christopher -8><---8><---8><---8><---8><---8><---8><---8><---8><---8><---8><---8><-- 'VBAcs-VBAto createEmacsshort-cutkeysin MS Word. 'Author: Christopher Rath 'Date: 2 Mar., 1998 'Version: 0.1 'Copyright (c) 1998 Christopher Rath 'Distributed under Perl's "Artistic License" 'This is a first cut at suchmacros. They are not 'ideal; this version is really a "proof of concept" 'not a finished product. 'Place thesemacrosin a Production module within 'a document that resides within your Startup folder. Public Sub TypeEn() 'To be assigned to "[ALT]-". Selection.TypeText Chr$(150) End Sub Public Sub TypeEm() 'To be assigned to "[ALT][SHIFT]-". Selection.TypeText Chr$(151) End Sub Public Sub ClearToEndOfLine() 'To be assigned to "[CTRL]K". Selection.EndKey Unit:=wdLine, Extend:=wdExtend Selection.Delete Unit:=wdCharacter, Count:=1 End Sub Public Sub RemapKeys() 'This Sub remaps my keyboard, a laEmacs. CustomizationContext = NormalTemplate KeyBindings.Add KeyCategory:=wdKeyCategoryMacro, Command:="TypeEn",KeyCode:=BuildKeyCode(wdKeyAlt, wdKeyHyphen) '"[A]-" KeyBindings.Add KeyCategory:=wdKeyCategoryMacro, Command:="TypeEm",KeyCode:=BuildKeyCode(wdKeyAlt, wdKeyShift, wdKeyHyphen) '"[A][SHIFT]-" KeyBindings.Add KeyCode:=BuildKeyCode(wdKeyControl, wdKeyP),KeyCategory:=wdKeyCategoryCommand, Command:="LineUp" '"[C}P" KeyBindings.Add KeyCode:=BuildKeyCode(wdKeyControl, wdKeyN),KeyCategory:=wdKeyCategoryCommand, Command:="LineDown" '"[C]N" KeyBindings.Add KeyCode:=BuildKeyCode(wdKeyControl, wdKeyE),KeyCategory:=wdKeyCategoryCommand, Command:="EndOfLine" '"[C]E" KeyBindings.Add KeyCode:=BuildKeyCode(wdKeyControl, wdKeyA),KeyCategory:=wdKeyCategoryCommand, Command:="StartOfLine" '"[C]A" KeyBindings.Add KeyCode:=BuildKeyCode(wdKeyControl, wdKeyF),KeyCategory:=wdKeyCategoryCommand, Command:="CharRight" '"[C]F" KeyBindings.Add KeyCode:=BuildKeyCode(wdKeyControl, wdKeyB),KeyCategory:=wdKeyCategoryCommand, Command:="CharLeft" '"[C]B" KeyBindings.Add KeyCode:=BuildKeyCode(wdKeyControl, wdKeyS),KeyCategory:=wdKeyCategoryCommand, Command:="EditFind" '"[C]S" KeyBindings.Add KeyCode:=BuildKeyCode(wdKeyControl, wdKeyW),KeyCategory:=wdKeyCategoryCommand, Command:="EditCut" '"[C]W" KeyBindings.Add KeyCode:=BuildKeyCode(wdKeyControl, wdKeyY),KeyCategory:=wdKeyCategoryCommand, Command:="EditPaste" '"[C]Y" KeyBindings.Add KeyCode:=BuildKeyCode(wdKeyAlt, wdKeyW), KeyCategory:=wdKeyCategoryCommand, Command:="EditCopy" '"[A]W" KeyBindings.Add KeyCode:=BuildKeyCode(wdKeyShift, wdKeyControl,wdKeyHyphen), KeyCategory:=wdKeyCategoryCommand, Command:="EditUndo" '"[S][C]-" KeyBindings.Add KeyCode:=BuildKeyCode(wdKeyAlt, wdKeyD),KeyCategory:=wdKeyCategoryCommand, Command:="DeleteWord" '"[A]D" KeyBindings.Add KeyCode:=BuildKeyCode(wdKeyShift, wdKeyAlt,wdKeyComma), KeyCategory:=wdKeyCategoryCommand,Command:="StartOfDocument" '"[S][A]<" KeyBindings.Add KeyCode:=BuildKeyCode(wdKeyShift, wdKeyAlt,wdKeyPeriod), KeyCategory:=wdKeyCategoryCommand,Command:="EndOfDocument" '"[S][A]>" KeyBindings.Add KeyCode:=BuildKeyCode(wdKeyControl, wdKeyV),KeyCategory:=wdKeyCategoryCommand, Command:="PageDown" '"[C]V" KeyBindings.Add KeyCode:=BuildKeyCode(wdKeyAlt, wdKeyV),KeyCategory:=wdKeyCategoryCommand, Command:="PageUp" '"[A]V" KeyBindings.Add KeyCode:=BuildKeyCode(wdKeyAlt, wdKeyF),KeyCategory:=wdKeyCategoryCommand, Command:="WordRight" '"[A]F" KeyBindings.Add KeyCode:=BuildKeyCode(wdKeyAlt, wdKeyB),KeyCategory:=wdKeyCategoryCommand, Command:="WordLeft" '"[A]B" KeyBindings.Add KeyCode:=BuildKeyCode(wdKeyControl, wdKeyG),KeyCategory:=wdKeyCategoryCommand, Command:="Cancel" '"[C]G" KeyBindings.Add KeyCode:=BuildKeyCode(wdKeyAlt, wdKeyBackspace),KeyCategory:=wdKeyCategoryCommand, Command:="DeleteBackWord" '"[A][BS]" KeyBindings.Add KeyCode:=BuildKeyCode(wdKeyControl, wdKeyD),KeyCategory:=wdKeyCategoryCommand, Command:="EditClear" '"[C]D" KeyBindings.Add KeyCode:=BuildKeyCode(wdKeyControl, wdKeyK),KeyCategory:=wdKeyCategoryCommand, Command:="ClearToEndOfLine" '"[C]K" End Sub -8><---8><---8><---8><---8><---8><---8><---8><---8><---8><---8><---8><-- === Christopher Rath === cr...@nortel.ca === (613) 765-3141 === Northern Telecom Ltd. | Box 3511, Station `C' | ``Hydrogen is a colourless, odourless Ottawa, ON K1Y 4H7 | gas which, given enough time, turns FAX: (613) 763-4101 | into people.'' --- Henry Hiebert