Finding Chrw Codes.....


D

Deepak Mhaskar

Hi,

I am newbie to VBA programming. I want to find Greek Symbols through VBA.
But i don't know Chrw codes..i.e., Chr(13).... Where i can find the list of
chr codes. Or anyone can give me the list.

Thanks in Advance.
 
Ad

Advertisements

J

Jay Freedman

On Fri, 16 Sep 2005 22:51:06 -0700, "Deepak Mhaskar" <Deepak
Hi,

I am newbie to VBA programming. I want to find Greek Symbols through VBA.
But i don't know Chrw codes..i.e., Chr(13).... Where i can find the list of
chr codes. Or anyone can give me the list.

Thanks in Advance.

Open the Insert > Symbol dialog, set the font to Symbol or whatever
font you're using, and set the dropdown at the bottom right to Unicode
or ASCII. As you click on each character, its character code value
will be displayed.
 
G

Graham Mayor

Or select the character in a document and run 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 As String
Dim strNums As String
Dim 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
 
C

c2leeman

I am hoping that this will reach others looking for the number codes for the ChrW function in VBA for Excel. This simple macro will generate 65000 ChrW codes and is simple enough that a user can change certain parameters in the macro to suit their needs. Depending on your system, it may take a minute or two to run, so be patient. Screen updating is turned off by default, so it may look as though it is not operating.

Create a module in a new worksheet using VBA - Alt+f11 - and paste this code:

Sub charactercodes()


Application.ScreenUpdating = False
Range("B1") = "ChrW CODE"
Range("C1") = "OUTPUT"
Rows("1:1").ShrinkToFit = True
A = 1 'CHARACTER CODE VALUE
CROW = 2 'CURRENT ROW #
CCOL = 2 'CURRENT COLUMN NUMBER
Cells.Select
With Selection
.NumberFormat = "@"
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.Font.Name = "ARIAL"
.Font.Size = 14
.RowHeight = 20
End With
Columns(1).ColumnWidth = 1
Columns(1).Interior.ColorIndex = 14
Columns(2).ColumnWidth = 10
Columns(3).ColumnWidth = 6
Do
Cells(CROW, CCOL) = A
Cells(CROW, (CCOL + 1)) = ChrW(A)
A = A + 1
CROW = CROW + 1
If CROW = 102 Then
CROW = 2
CCOL = CCOL + 3
Columns(CCOL - 1).ColumnWidth = 1
Columns(CCOL - 1).Interior.ColorIndex = 14
Columns(CCOL).ColumnWidth = 10
Columns(CCOL + 1).ColumnWidth = 6
End If
If A = 65001 Then
Exit Do
End If
Loop
Application.ScreenUpdating = True



End Sub


Hope it helps
 
Ad

Advertisements

Joined
Apr 3, 2020
Messages
1
Reaction score
0
I am hoping that this will reach others looking for the number codes for the ChrW function in VBA for Excel. This simple macro will generate 65000 ChrW codes and is simple enough that a user can change certain parameters in the macro to suit their needs. Depending on your system, it may take a minute or two to run, so be patient. Screen updating is turned off by default, so it may look as though it is not operating.

Create a module in a new worksheet using VBA - Alt+f11 - and paste this code:

Sub charactercodes()


Application.ScreenUpdating = False
Range("B1") = "ChrW CODE"
Range("C1") = "OUTPUT"
Rows("1:1").ShrinkToFit = True
A = 1 'CHARACTER CODE VALUE
CROW = 2 'CURRENT ROW #
CCOL = 2 'CURRENT COLUMN NUMBER
Cells.Select
With Selection
.NumberFormat = "@"
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.Font.Name = "ARIAL"
.Font.Size = 14
.RowHeight = 20
End With
Columns(1).ColumnWidth = 1
Columns(1).Interior.ColorIndex = 14
Columns(2).ColumnWidth = 10
Columns(3).ColumnWidth = 6
Do
Cells(CROW, CCOL) = A
Cells(CROW, (CCOL + 1)) = ChrW(A)
A = A + 1
CROW = CROW + 1
If CROW = 102 Then
CROW = 2
CCOL = CCOL + 3
Columns(CCOL - 1).ColumnWidth = 1
Columns(CCOL - 1).Interior.ColorIndex = 14
Columns(CCOL).ColumnWidth = 10
Columns(CCOL + 1).ColumnWidth = 6
End If
If A = 65001 Then
Exit Do
End If
Loop
Application.ScreenUpdating = True



End Sub


Hope it helps
How do I run that "simple macro"? I know how to run a word macro, but when I paste that text into a word macro, it doesn't work. What does "Create a module in a new worksheet using VBA - Alt+f11" mean, since it apparently doesn't mean "create a word macro"?

And thanks in advance, this is just what I was looking for, if I can get it to run.
 
Ad

Advertisements


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top