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.
On Fri, 16 Sep 2005 22:51:06 -0700, "Deepak Mhaskar" <Deepak 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.
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
If it's Unicode (as opposed to Symbol font), you could also look at http://www.unicode.org/charts/PDF/U0370.pdf If you want to insert them, use ChrW instead of Chr. And you can use hex numbers by putting &H in front of the code: Selection.InsertAfter ChrW(&H03C0) Regards, Klaus
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