Solved

Put cyrillic chars from VB to Excel

Posted on 2004-04-25
8
1,103 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
ID: 10913773
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
ID: 10913845
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
ID: 10913854
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
Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

 
LVL 3

Author Comment

by:tofra
ID: 10914145
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
ID: 10914158
it's because of the Pagecode of the russion or cyrillic  isnt installed on the system :)
0
 
LVL 7

Expert Comment

by:OHDev2004
ID: 10914380
no problem :)
0
 

Accepted Solution

by:
modulo earned 0 total points
ID: 10916079
PAQ-ing the question and refunding 250  points

Thanks  OHDev2004 !

modulo

Community Support Moderator
Experts Exchange
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

821 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