2016-06-27 30 views
1

VBA ExcelのセルからUnicode文字を読み戻すのに苦労しています。VBAマクロExcel:ExcelセルからUnicode文字を読み取る方法

Sub mySub() 
    Cells(1, "A").Value = ChrW(10003) ' Writes checkbox symbol to A1 

    MsgBox Asc(Cells(1, "A").Value)  ' Output: 63 (questionmark symbol) 
             ' Expected Output: 10003 
End Sub 

ユーザーがチェックボックスのシンボルを変更した場合は、Unicode文字を読み取って確認する必要があります。 Unicode文字とセル値を比較する方法はありません。

答えて

3

時には必要なのは、目の第2のペアです。 :)

Sub mySub() 
    Cells(1, "A").Value = ChrW(10004) ' Writes checkbox symbol to A1 

    'MsgBox Asc(Cells(1, "A").Value)  ' Output: 63 (questionmark symbol) 
            ' Expected Output: 10003 
    '/ Works! 
    MsgBox AscW(Cells(1, "A").Value2) 'Almost there. Use AscW instead of Asc 
End Sub 
関連する問題