Unicode Values for Symbols
Unicode Values for Symbols
(OP)
This question sort of ties in with an earlier one on macros. Basically, I am trying to write a macro for Word that will find a predefined bunch of symbols and replace them with their ASCII equivalent. What I have now uses the find and replace code to find symbols, using the ChrW(n) value for the find value, and the ASCII code for the replace. My problem now is how to get a complete listing of the "unicode values" Word uses. I used the code below that I found on the microsoft site to generate unicode values:
Sub UnicodeGenerator()
Dim I As Integer
Documents.Add
' Set tab stops for clarity.
Selection.ParagraphFormat.TabStops.ClearAll
ActiveDocument.DefaultTabStop = InchesToPoints(0.5)
Selection.ParagraphFormat.TabStops.Add Position:= _
InchesToPoints(1.5), Alignment:=wdAlignTabCenter, _
Leader:=wdTabLeaderDots
' Insert column headings.
Selection.InsertAfter "Characters" & Chr(9) & "UniCode Values"
Selection.InsertParagraphAfter
' Character values below 30 generate undesirable results
' when inserted into a document. For example, page breaks
' and column breaks.
For I = 30 To 255
' Insert the character, a tab and the Unicode equivalent.
Selection.InsertAfter Chr(I) & Chr(9) & AscW(Chr(I))
Selection.InsertParagraphAfter
Next
End Sub
The problem with this code is that it doesn't generate unicode values for symbols such as greek letters etc. Another problem is that the uncode values generated don't seem to match with lists I got off of the Unicode Consortium site. For instance, the above code generates a value of 176 for the degree sign, while the Unicode Consortium gives 00B0 as the value. This may be a simple conversion that I am not aware of, but my main problem is not knowing how to generate the proper values (proper for word to use) for greek letters.
Any suggestions?
Ben
Sub UnicodeGenerator()
Dim I As Integer
Documents.Add
' Set tab stops for clarity.
Selection.ParagraphFormat.TabStops.ClearAll
ActiveDocument.DefaultTabStop = InchesToPoints(0.5)
Selection.ParagraphFormat.TabStops.Add Position:= _
InchesToPoints(1.5), Alignment:=wdAlignTabCenter, _
Leader:=wdTabLeaderDots
' Insert column headings.
Selection.InsertAfter "Characters" & Chr(9) & "UniCode Values"
Selection.InsertParagraphAfter
' Character values below 30 generate undesirable results
' when inserted into a document. For example, page breaks
' and column breaks.
For I = 30 To 255
' Insert the character, a tab and the Unicode equivalent.
Selection.InsertAfter Chr(I) & Chr(9) & AscW(Chr(I))
Selection.InsertParagraphAfter
Next
End Sub
The problem with this code is that it doesn't generate unicode values for symbols such as greek letters etc. Another problem is that the uncode values generated don't seem to match with lists I got off of the Unicode Consortium site. For instance, the above code generates a value of 176 for the degree sign, while the Unicode Consortium gives 00B0 as the value. This may be a simple conversion that I am not aware of, but my main problem is not knowing how to generate the proper values (proper for word to use) for greek letters.
Any suggestions?
Ben