> How can I set up Word so that when I am in a Courier New font section, and type a single or double quote at
> the keyboard, it will use Ascii 39 (') or Ascii 34 ("), respectively?
[quoted text clipped - 12 lines]
> Thunderbird newsreader showed it as sent, but it never showed up in the newsgroup. Anyone know what the story
> is on that?
In the meantime, I figured out a solution to my question which works
quite nicely (with KeyBindings). However, in going to check the settings
you referred to, I found that I could not get rid of my solution -
event explicitly clearing the KeyBindings.ClearAll and shutting down
Word was not sufficient. I eventually had to remove the functions
that the KeyBindings hooked into, and when I replaced them, things
operated normally.
OK, first of all those settings were checked, and it was the
'Autoformat As You Type' tab that I had to uncheck to remove the
replacement of "Straight Quotes" with "Smart Quotes". But the
fact is that I like Smart Quotes, except when I'm in a code
section. Furthermore, I don't think I can gain the type of
functionality I'm after with AutoCorrect.
So here is the solution that I have. It seems to be working
nicely, and I am so far quite pleased with it. I put
the following code into a module within the document and have
to enable macros:
Tools \ Macros \ Security \ Trusted Publishers then set
Trust Access to Visual Basic Project
Also, to avoid getting asked each time I also had to select:
Tools \ Macros \ Security \ Security Level \ Low
Sub AutoOpen()
Application.KeyBindings.ClearAll 'Spotty track record
CustomizationContext = ThisDocument 'else goes to Normal.Dot
KeyBindings.Add wdKeyCategoryMacro, "SQuote", wdKeySingleQuote
KeyBindings.Add wdKeyCategoryMacro, "DQuote", _
BuildKeyCode(wdKeyShift, wdKeySingleQuote)
End Sub
Function rightSideTest(sel As Selection)
'return true if sel follows a character after
'which there should be a closing quote
rightSideTest = sel.Start > 0
If Not rightSideTest Then Exit Function
ask = Asc(sel.Document.Range(sel.Start - 1, sel.Start).Text)
If ask <= 27 Then
rightSideTest = False
ElseIf ask = Asc(" ") Then
rightSideTest = False
ElseIf ask = Asc("[") Then
rightSideTest = False
ElseIf ask = Asc("{") Then
rightSideTest = False
ElseIf ask = Asc("(") Then
rightSideTest = False
ElseIf ask = Asc("<") Then
rightSideTest = False
End If
End Function
Sub SQuote()
' Put in a right/left single quote except in Courier make it straight
Dim newChar: newChar = "'"
If Mid(Selection.Font.Name, 1, 7) <> "Courier" Then
If rightSideTest(Selection) Then newChar = ChrW(8217) _
Else newChar = ChrW(8216)
End If
Selection.TypeText newChar
End Sub
Sub DQuote()
' Put in a right/left double quote except in Courier make it straight
Dim newChar: newChar = """"
If Mid(Selection.Font.Name, 1, 7) <> "Courier" Then
If rightSideTest(Selection) Then newChar = ChrW(8221) _
Else newChar = ChrW(8220)
End If
Selection.TypeText newChar
End Sub
Csaba Gabor from Vienna
> Quick Check: Insert, AutoText, AutoText, AutoFormat is "Straight Quotes" with
> "smart quotes" selected. deselect if so.
[quoted text clipped - 20 lines]
>> Thunderbird newsreader showed it as sent, but it never showed up in the newsgroup. Anyone know what the story
>> is on that?