Skip to content

Instantly share code, notes, and snippets.

@dck-jp
Created August 25, 2012 13:28
Show Gist options
  • Save dck-jp/3465660 to your computer and use it in GitHub Desktop.
Save dck-jp/3465660 to your computer and use it in GitHub Desktop.
SetShortcutKeys @ VBA
Sub SetShortcutKeys()
Dim macroSetting As Variant
Dim commandSetting As Variant
macroSetting = Array( _
"EraseColor", wdKeyControl + wdKeyQ, _
"EraseHighlight", wdKeyControl + wdKeyT, _
"ToggleUnderline", wdKeyControl + wdKeyW, _
"ToggleHighlight", wdKeyControl + wdKeyE, _
"DobuleUnderline", wdKeyControl + wdKeyD, _
"GrayOut", wdKeyControl + wdKeySemiColon, _
"StrikeAndColoredToRed", wdKeyControl + wdKeyEquals, _
"PasteAsLink", wdKeyControl + wdKeyL, _
"*** END ***" _
)
commandSetting = Array( _
"FileSaveAs", wdKeyControl + wdKeyS, _
"InsertNewComment", wdKeyControl + wdKeyK, _
"*** END ***" _
)
'-------------------------------------------------------
Dim i As Integer
For i = 0 To UBound(macroSetting) - 1 Step 2
Call KeyBindings.Add(wdKeyCategoryMacro, _
macroSetting(i), macroSetting(i + 1))
Next
For i = 0 To UBound(commandSetting) - 1 Step 2
Call KeyBindings.Add(wdKeyCategoryCommand, _
commandSetting(i), commandSetting(i + 1))
Next
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment