JohnRobinAllen
asked on
Keycode constants for a vertical bar or reverse slash
A search for "keyboard constants" in MS Word help or a Google search brings up a table of Keycode constants. Neither location shows a keycode for the "\" (reverse slash) or the "|" (vertical bar, which is a shift + the reverse slash).
I am using the following command in VBA to program a shortcut to run a subroutine:
KeyBindings.Add KeyCategory:=wdKeyCategory Macro, _
Command:="MontTableToAutoC orrect", _
KeyCode:=BuildKeyCode(wdKe yShift, wdKeyAlt, wdKeyM)
That programs a Shift+Alt+M to run the "MontTableToAutoCorrect" subroutine. I would like to change it to a Shift+Alt+|, which would mean I should change wdKeyM. I just cannot see what the keyboard constant would be for a vertical bar.
Thanks!
--j.r.a.
I am using the following command in VBA to program a shortcut to run a subroutine:
KeyBindings.Add KeyCategory:=wdKeyCategory
Command:="MontTableToAutoC
KeyCode:=BuildKeyCode(wdKe
That programs a Shift+Alt+M to run the "MontTableToAutoCorrect" subroutine. I would like to change it to a Shift+Alt+|, which would mean I should change wdKeyM. I just cannot see what the keyboard constant would be for a vertical bar.
Thanks!
--j.r.a.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I realize that this question is closed, but despite my premature enthusiasm for the solution I had accepted six years ago,
that solution above will not work.
In the interests of resolving the question for others, there is a solution. To code for a vertical bar, use two codes, as in:
BuildKeyCode(wdKeyShift, wdKeyBackSlash, wdKeyControl, wdKeyAlt)
where "wdKeyShift, wdKeyBlackSlash" effectively indicate the otherwise missing constant for a vertical bar. To type a vertical bar on a keyboard, you have to type Shift + the backslash.
--John Robin Allen, Priddis, Alberta
that solution above will not work.
In the interests of resolving the question for others, there is a solution. To code for a vertical bar, use two codes, as in:
BuildKeyCode(wdKeyShift, wdKeyBackSlash, wdKeyControl, wdKeyAlt)
where "wdKeyShift, wdKeyBlackSlash" effectively indicate the otherwise missing constant for a vertical bar. To type a vertical bar on a keyboard, you have to type Shift + the backslash.
--John Robin Allen, Priddis, Alberta
ASKER
The solution is so simple, it makes me feel justifiably stupid. I am grateful for the help.
Thanks!