Finding Chrw Codes.....

Discussion in 'Word VBA' started by Deepak Mhaskar, Sep 17, 2005.

  1. 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.
     
    Deepak Mhaskar, Sep 17, 2005
    #1
    1. Advertisements

  2. Deepak Mhaskar

    Jay Freedman Guest

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

    >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.

    --
    Regards,
    Jay Freedman
    Microsoft Word MVP
     
    Jay Freedman, Sep 17, 2005
    #2
    1. Advertisements

  3. Deepak Mhaskar

    Graham Mayor Guest

    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


    --
    <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
    Graham Mayor - Word MVP


    <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
    Jay Freedman wrote:
    > On Fri, 16 Sep 2005 22:51:06 -0700, "Deepak Mhaskar" <Deepak
    > > wrote:
    >
    >> 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.
     
    Graham Mayor, Sep 17, 2005
    #3
  4. Deepak Mhaskar

    Klaus Linke Guest

    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


    "Jay Freedman" <> wrote:
    > On Fri, 16 Sep 2005 22:51:06 -0700, "Deepak Mhaskar" <Deepak
    > > wrote:
    >
    >>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.
    >
    > --
    > Regards,
    > Jay Freedman
    > Microsoft Word MVP
     
    Klaus Linke, Sep 18, 2005
    #4
  5. Deepak Mhaskar

    Guest

    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
     
    , Dec 18, 2013
    #5
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.
Similar Threads
  1. fred kruger

    altering field codes

    fred kruger, Jun 30, 2003, in forum: Word VBA
    Replies:
    1
    Views:
    194
    Doug Robbins - Word MVP
    Jul 1, 2003
  2. Dawn

    Using text from field codes

    Dawn, Aug 15, 2003, in forum: Word VBA
    Replies:
    2
    Views:
    193
    Jay Freedman
    Aug 15, 2003
  3. Kelly

    Logo's and Field Codes??

    Kelly, Aug 28, 2003, in forum: Word VBA
    Replies:
    2
    Views:
    119
    Lars-Eric Gisslén
    Aug 29, 2003
  4. Steve Lang

    Insert Symbol vs Chrw()

    Steve Lang, Sep 10, 2003, in forum: Word VBA
    Replies:
    2
    Views:
    412
    Steve Lang
    Sep 11, 2003
  5. Guest

    Field codes

    Guest, Sep 16, 2003, in forum: Word VBA
    Replies:
    1
    Views:
    158
    Jay Freedman
    Sep 16, 2003
  6. Jason

    advance word field codes

    Jason, Sep 17, 2003, in forum: Word VBA
    Replies:
    1
    Views:
    165
    Jay Freedman
    Sep 17, 2003
  7. Fred Kruger

    PJA Printer Codes

    Fred Kruger, Sep 19, 2003, in forum: Word VBA
    Replies:
    4
    Views:
    205
    fred kruger
    Sep 21, 2003
  8. Bruce

    Page number and field codes

    Bruce, Sep 20, 2003, in forum: Word VBA
    Replies:
    4
    Views:
    238
    Lars-Eric Gisslén
    Sep 21, 2003
Loading...