You can check the ANSI code of an inserted character with the following
macro
Sub ANSIValue()
S1$ = "Because the selected text contains"
S2$ = " characters, not all of the ANSI values will be displayed."
S3$ = "ANSI Value ("
S4$ = " characters in selection)"
S5$ = " character in selection)"
S6$ = "Text must be selected before this macro is run."
S7$ = "ANSI Value"
Dim strSel, strNums, LastFourChar As String
Dim iPos As Integer
strSel = Selection.Text
If Len(strSel) > 0 Then
For i = 1 To Len(strSel)
strNums = strNums + str(Asc(Mid(strSel, i)))
Next i
strNums = LTrim(strNums)
If Len(strNums) > 255 Then
LastFourChar = Mid(strNums, 252, 4)
strNums = Left(strNums, 251) + Left(LastFourChar, 4 - InStr(" ",
LastFourChar))
MsgBox S1$ + str(Len(strSel)) + S2$
End If
If Len(strSel) = 1 Then S4$ = S5$
MsgBox strNums, 0, S3$ + LTrim(str(Len(strSel))) + S4$
Else
MsgBox S6$, 0, S7$
End If
End Sub
The smart quote characters are present in both Times New Roman and Courier
New (though obviously have a different appearance from one another). One
ploy may be to run the macro I posted earlier to change them all to straight
quotes then run autoformat with the straight quotes to smart quotes option
set.
--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Thanks, Helmut. I'll try that. I'll have to study Graham's solution
too. Maybe it's a font problem rather than a character problem, since
the right characters are already in the text, according to Graham.
Someone edited my text and changed the font to Courier New. When I
change it back to Times New Roman, my curly quotes seem to have
disappeared.
Cheers,
S.
Helmut said:
Hi Shirley,
often autocorrect issues seem to prevent a replacement.
In fact, they don't, it's only that the replacement
is corrected immediately afterwards.
You may prevent autocorrection by
setting the found range to a new character,
like that:
Sub Test6777()
Dim rDcm As Range
Set rDcm = ActiveDocument.Range
With rDcm.Find
.Text = "[^0145-^0148]"
.MatchWildcards = True
While .Execute
rDcm.Select ' for testing using F8
' rdcm.Text = what character?
rDcm.Collapse Direction:=wdCollapseEnd ' maybe not required
Wend
End With
End Sub
--
Greetings from Bavaria, Germany
Helmut Weber, MVP WordVBA
Vista Small Business, Office XP