Solved

Put cyrillic chars from VB to Excel

Posted on 2004-04-25
8
1,093 Views
Last Modified: 2008-02-01
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!
0
Comment
Question by:tofra
  • 4
  • 2
8 Comments
 
LVL 7

Expert Comment

by:OHDev2004
Comment Utility
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
0
 
LVL 3

Author Comment

by:tofra
Comment Utility
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)
0
 
LVL 7

Expert Comment

by:OHDev2004
Comment Utility
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 ,,,,
0
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 
LVL 3

Author Comment

by:tofra
Comment Utility
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.

0
 
LVL 7

Expert Comment

by:OHDev2004
Comment Utility
it's because of the Pagecode of the russion or cyrillic  isnt installed on the system :)
0
 
LVL 7

Expert Comment

by:OHDev2004
Comment Utility
no problem :)
0
 

Accepted Solution

by:
modulo earned 0 total points
Comment Utility
PAQ-ing the question and refunding 250  points

Thanks  OHDev2004 !

modulo

Community Support Moderator
Experts Exchange
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now