WordでSublimeText2のキーボードショートカットを使う

以前、秀丸エディタでSublimeText2のキーボードショートカットを使うという記事を書きました。
これと同じことを今度はWordでやってみます。

  • 行の複製(Ctrl+Shift+D)
  • 行のカット(Ctrl+Shift+K)
  • 行の上移動(Ctrl+Shift+Up)
  • 行の下移動(Ctrl+Shift+Down)

これらについて対応します。
秀丸のときに対応した「コメント化」についてはWordでは意味がないのでやりません。

マクロ

マクロは次の通りです。

Sub 行の複製()
    Selection.HomeKey Unit:=wdLine
    Selection.EndKey Unit:=wdLine, Extend:=wdExtend
    Selection.Copy
    Selection.MoveDown Unit:=wdLine, Count:=1
    Selection.PasteAndFormat (wdPasteDefault)
End Sub
Sub 行のカット()
    Selection.HomeKey Unit:=wdLine
    Selection.EndKey Unit:=wdLine, Extend:=wdExtend
    Selection.Cut
End Sub
Sub 行の上移動()
    Selection.HomeKey Unit:=wdLine
    Selection.EndKey Unit:=wdLine, Extend:=wdExtend
    Selection.Cut
    Selection.MoveUp Unit:=wdLine, Count:=1
    Selection.PasteAndFormat (wdPasteDefault)
    Selection.MoveUp Unit:=wdLine, Count:=1
End Sub
Sub 行の下移動()
    Selection.HomeKey Unit:=wdLine
    Selection.EndKey Unit:=wdLine, Extend:=wdExtend
    Selection.Cut
    Selection.MoveDown Unit:=wdLine, Count:=1
    Selection.PasteAndFormat (wdPasteDefault)
    Selection.MoveUp Unit:=wdLine, Count:=1
End Sub

ショートカット

キーボードショートカットの設定についてはWordでショートカットキーを設定を参照してください。

コメント

タイトルとURLをコピーしました