Link to home
Start Free TrialLog in
Avatar of tofra
tofra

asked on

Put cyrillic chars from VB to Excel

How can i put cyrillic characters to Excel using VB? I have the unicode for the chars i need to use. For example, \u0419 (ƣ)

Now i'm using the following code:

But this shows an ? in excel. (also in clipboard)
 Set ObjExcel = New Excel.Application
 ObjExcel.Workbooks.Open ("c:\tom.xls")
 ObjExcel.Worksheets("Sheet1").Activate
 ObjExcel.Range(Header).Activate
 Clipboard.Clear
 Clipboard.SetText (Chr(4) & chr(19))
 ObjExcel.Selection.PasteSpecial
 Clipboard.Clear
 ObjExcel.Workbooks(1).Close SaveChanges:=True
 Set ObjExcel = Nothing

Trying to write to a text file was succesful!
Open "c:\tomresult.txt" For Output As #1
Print #1, Chr(255) & Chr(254) & Chr(19) & Chr(4)
Close #1

Please HELP!
Avatar of Amro Osama
Amro Osama
Flag of Egypt image

Read this man ,, its a matter that when you copy the cyrillic code the clipboard converts it to the pagecode of the windows, ,, so you need a 3rd parity software as mentioned in the link below ,,

http://www.relcom.ru/English/Russification/WinNetscape/w2ie_eng.html#unipad
Avatar of tofra
tofra

ASKER

The complete progress is, greb data from mysql database, put it into the excel file. Because everything is automated, i can't use this manual action. The purpose i'm using it for is to create an invoice with cyrillic chars. (customs demand it)
i know but when you paste the text to the clipboard it's converted to nonunicode
then you try to paste it ,,
look there is another way for doing this :

the string abcd is actually U+0061 U+0062 U+0063 U+0064

so i think you must make a routine to get the character or its unicode then return the code as above then copy it to clipboard ,, and paste it as you've done ,,,,
Avatar of tofra

ASKER

I found it!
Instead of using the clipboard for pasting my text to excel, i can do it directly!

 ObjExcel.Range("A1").Value = ChrB(19) & ChrB(4)
Now i saw the cyrillic character.

Still, i find it strange that the clipboard can't work together with vb and handle unicode. Copy past with notepad works well.

it's because of the Pagecode of the russion or cyrillic  isnt installed on the system :)
no problem :)
ASKER CERTIFIED SOLUTION
Avatar of modulo
modulo

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial