Emacs's control-K in Microsoft Word
This VBA (Visual Basic for Applications) macro simulates the "Control-K" command of Emacs (delete to the end of line).Sub EmacsControlK() ' ' EmacsControlK Macro ' ' Dim oRng As Word.Range If Selection.Information(wdWithInTable) Then Set oRng = Selection.Cells(1).Range oRng.MoveEnd wdCharacter, -1 oRng.Start = Selection.Start oRng.Delete Else Selection.EndKey Unit:=wdLine, Extend:=wdExtend If Selection.End > Selection.Start + 1 Then Selection.End = Selection.End - 1 End If Selection.Cut End If End Sub
Copyright © Ben Bullock 2009-2024. All
rights reserved.
For comments, questions, and corrections, please email
Ben Bullock
(benkasminbullock@gmail.com) or use the discussion group at Google Groups.
/
Privacy /
Disclaimer