Using Hebrew in a Macro
Whilst you cannot type Hebrew (or rather any non-ANSI text) in the VBE, you
can work with its Unicode numbers, either Hex or decimal and the ChrW
function.
If you are bring this Hebrew text into VBA from outside (a text file or some
other app) look into using Byte arrays and StrConv.
Dim Unicodes As Variant
Dim i As Long
Const SomeHebrewHexCodes As String = "05D0,05E0,05D2,05E6"
For Each Unicodes In Split(SomeHebrewHexCodes, ",")
Range("A1").Offset(i, 0).Value = ChrW("&H" & Unicodes)
i = i + 1
Next
You can get the code for any letter on the worksheet with:
Public Function GetUnicodeValue(argText As Variant, _
WhichLetter As Long, _
Optional AsDecimal As Boolean = True) As
Variant
GetUnicodeValue = AscW(Mid(argText, WhichLetter, 1))
If AsDecimal = False Then GetUnicodeValue = Hex(GetUnicodeValue)
End Function
NickHK
"Yehuda" wrote in message
...
Hi,
I need to be able to write hebrew letters to an excel spreadsheet from my
macro. I already have hebrew support installed on Windows XP.
What is the simplest way to do this?
I noticed I can't type in hebrew withen the Macro - is there a way to hard
code any text?
Thank you
|