Character Codes

Every character needs to be converted into a number before it can be saved.
Text is represented by assigning a numerical value to each letter, digit and symbol.
Character Encoding is the conversion of a symbol into a binary number


ASCII

The first widely adopted standard was the ASCII character set which uses the values 0 to 127 to represent the letters, numericals and commonly used punctuation marks and characters.
ASCII stands for American Standard Code for Information Interchange.
For example lowercase letters a-z are represented by the values 97-122
ASCII codes 0-31 represent non printing characters.
ASCII uses a 7-bit encoding scheme that represents 128 different numbers.
ASCII only supports one alphabet
The characters 1-9 and 11-31 and 128-159 are not supported by Windows.

1-9 58:87W116t
10 59;88X117u
11-31 60<89Y118v
32 61=90Z119w
33!62>91[120x
34"63?92\121y
35#64@93]122z
36$65A94^123{
37%66B95_124|
38&67C96`125}
39'68D97a126~
40(69E98b127
41)70F99c128€
42*71G100d  
43+72H101e  
44,73I102f  
45-74J103g  
46.75K104h  
47/76L105i  
48077M106j  
49178N107k  
50279O108l  
51380P109m  
52481Q110n  
53582R111o  
54683S112p  
55784T113q  
56885U114r  
57986V115s  

ANSI

ASCII was then extended to include additional numbers (129 - 255).
ANSI stands for American National Standards Institute.
ANSI is also known as extended ASCII.
ANSI uses a 8-bit encoding scheme that represents 218 numbers.
Also known as Windows-1252 and was the default font used in Windows 95.
This is compatible with ASCII.
ASC - Returns the ASCII / ANSI number for the first character in a text string.
CHR - Returns the character with the corresponding ASCII / ANSI number.

1-9 58:87W116t145‘174®203Ë232è
10 59;88X117u146’175¯204Ì233é
11-31 60<89Y118v147“176°205Í234ê
32 61=90Z119w148”177±206Î235ë
33!62>91[120x149•178²207Ï236ì
34"63?92\121y150–179³208Ð237í
35#64@93]122z151—180´209Ñ238î
36$65A94^123{152˜181µ210Ò239ï
37%66B95_124|153™182211Ó240ð
38&67C96`125}154š183·212Ô241ñ
39'68D97a126~155›184¸213Õ242ò
40(69E98b127156œ185¹214Ö243ó
41)70F99c128€157186º215×244ô
42*71G100d129158ž187»216Ø245õ
43+72H101e130‚159Ÿ188¼217Ù246ö
44,73I102f131ƒ160 189½218Ú247÷
45-74J103g132„161¡190¾219Û248ø
46.75K104h133…162¢191¿220Ü249ù
47/76L105i134†163£192À221Ý250ú
48077M106j135‡164¤193Á222Þ251û
49178N107k136ˆ165¥194Â223ß252ü
50279O108l137‰166¦195Ã224à253ý
51380P109m138Š167§196Ä225á254þ
52481Q110n139‹168¨197Å226â255ÿ
53582R111o140Œ169©198Æ227ã  
54683S112p141170ª199Ç228ä  
55784T113q142Ž171«200È229å  
56885U114r143172¬201É230æ  
57986V115s144173­202Ê231ç  

UNICODE

ANSI was then extended to include additional numbers (256 - 65,535)
It was soon realised that the 255 ASCII values were not sufficient for the number of characters that computers needed to work with.
The UNICODE character set is a universal standard across all systems.
Only 39,000 of these codes are currently assigned
The UNICODE character set is a universal standard across all systems.
UNICODE uses a 8-bit encoding scheme and has different types.
The most popular type is UTF-8 which is compatible with ASCII.
Windows does support Unicode but it will depend on your regional settings.
UTF8
UTF16
ASCW - Returns the Unicode number for the first character in a text string.
CHRW - Returns the character with the corresponding Unicode number.


Hexadecimal

The first 255 characters of Unicode are the same as the first 255 characters of ANSI.

space%20:%3AT%54n%6E
!%21;%3BU%55o%6F
"%22<%3CV%56p%70
#%23=%3DW%57q%71
$%24>%3EX%58r%72
%%25?%3FY%59s%73
&%26@%40Z%5At%74
'%27A%41[%5Bu%75
(%28B%42\%5Cv%76
)%29C%43]%5Dw%77
*%2AD%44^%5Ex%78
+%2BE%45_%5Fy%79
,%2CF%46`%60z%80
-%2DG%47a%61{%81
.%2EH%48b%62|%82
/%2FI%49c%63}%83
0%30J%4Ad%64~%84
1%31K%4Be%65  
2%32L%4Cf%66  
3%33M%4Dg%67  
4%34N%4Eh%68  
5%35O%4Fi%69  
6%36P%50j%6A  
7%37Q%51k%6B  
8%38R%52l%6C  
9%39S%53m%6D  

ASCW Bug

This returns the bit pattern for unsigned 16-bit integers.
VBA uses signed 16-bit integers so after 32767 this function will return negative numbers.
Use the following function instead

Public Function ASCW_2(ByVal sChar As String) As Integer 
   ASCW_2 = (ASCW(sChar) And &HFFF&)
End Function

DBCS Characters



© 2026 Better Solutions Limited. All Rights Reserved. © 2026 Better Solutions Limited TopPrevNext