M
Mark Tangard
Is there a way to specify the KeyCode constant for the double-quote key? It's
mysteriously missing from the Auto List Members of arguments to FindKeyCode.
I know it's a special key because when smart quotes are enabled it delivers the
appropriate opening or closing mark, but that's exactly what I'm trying to
fiddle with. I want to rebind the quote key to type a "dumb" quote if the
selection is in a certain font and a "smart" (curly) quote in all others.
I see how the smart-quote feature might preclude VBA from exposing this
constant, EXCEPT that the constant for the SINGLE quote key (whose output
adjusts similarly if the smart-quote feature is enabled) *is* there, and can be
manipulated in exactly the way I'm attempting. That is, I can bind wdSingleQuote
to the first macro shown below and get the result I'm after:
Sub PlainSingleQuote()
If Selection.Font.Name = "Tahoma" Then
Options.AutoFormatReplaceQuotes = False
DoEvents
Call PlainSingleQuote2
Else
Selection.TypeText Chr$(146)
End If
End Sub
Sub PlainSingleQuote2()
Selection.TypeText Chr$(39)
Options.AutoFormatReplaceQuotes = True
End Sub
Any clues at all, or suggestions for accomplishing it another way? (other than
running a global-replace macro at the end, which is what I'm doing now? TIA.
mysteriously missing from the Auto List Members of arguments to FindKeyCode.
I know it's a special key because when smart quotes are enabled it delivers the
appropriate opening or closing mark, but that's exactly what I'm trying to
fiddle with. I want to rebind the quote key to type a "dumb" quote if the
selection is in a certain font and a "smart" (curly) quote in all others.
I see how the smart-quote feature might preclude VBA from exposing this
constant, EXCEPT that the constant for the SINGLE quote key (whose output
adjusts similarly if the smart-quote feature is enabled) *is* there, and can be
manipulated in exactly the way I'm attempting. That is, I can bind wdSingleQuote
to the first macro shown below and get the result I'm after:
Sub PlainSingleQuote()
If Selection.Font.Name = "Tahoma" Then
Options.AutoFormatReplaceQuotes = False
DoEvents
Call PlainSingleQuote2
Else
Selection.TypeText Chr$(146)
End If
End Sub
Sub PlainSingleQuote2()
Selection.TypeText Chr$(39)
Options.AutoFormatReplaceQuotes = True
End Sub
Any clues at all, or suggestions for accomplishing it another way? (other than
running a global-replace macro at the end, which is what I'm doing now? TIA.