Using AscW function, It returns two negative numbers for each character, why? RRS feed

  • Question

  • I have an Arabic PDF. When I copied the text in a word document, it's characters changed into some square shape characters. And when I used AscW function to see characters codes, I get two negative numbers for each one. First number always is -9280 and second number is variable for each character. Why it has happened?

    This is what has been copied in the word document:


    And this is my program to get character codes:

    Sub Chr_Codes()
    Dim i As Long
    Dim In_String, Out_String, In_String_Char As String
    In_String = Selection
    For i = 1 To Len(In_String) Step 1
        In_String_Char = Mid(In_String, i, 1)
        Out_String = Str(AscW(In_String_Char)) + " " + In_String_Char
        Selection.EndKey Unit:=wdLine
        Selection.TypeText Text:=Out_String
    Next i
    End Sub

    Copy the text in a word document, Highlight it and run the program. Why it has happened?

    I will be thankful for your answer.

    Friday, May 31, 2013 8:01 AM