ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Using Hebrew in a Macro (https://www.excelbanter.com/excel-programming/388370-using-hebrew-macro.html)

Yehuda[_2_]

Using Hebrew in a Macro
 
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


Gary''s Student

Using Hebrew in a Macro
 
Use unicode. Write the characters as unicode and set a font to support the
characters.


see:

http://unicode.org/charts/PDF/U0590.pdf


--
Gary''s Student - gsnu200718


"Yehuda" wrote:

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


NickHK

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





All times are GMT +1. The time now is 04:28 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com