?
Solved

Unicode and ASCII

Posted on 2008-06-19
4
Medium Priority
?
985 Views
Last Modified: 2013-11-25
Hi Experts,
How can I read data from a Excel file using VB6. The data inside the columns are in Arabic. I must read the data as UNICODE, store in a database as UNICODE and while using this data later to send to another application, I must send that as ASCII.

GKH
0
Comment
Question by:harishkg
  • 2
4 Comments
 
LVL 7

Expert Comment

by:Dauhee
ID: 21830684
Can get via VB6 with:


Private mobjExcelApp As Object
Private mobjWkBkMain As Object
Private mobjWkShMain As Object
Private mobjRange As Object

        Set mobjExcelApp = CreateObject("Excel.Application")
        mobjExcelApp.Visible = True
Set mobjWkBkMain = mobjExcelApp.Workbooks.Open("C:\book.xls")
Set mobjWkShMain = mobjWkBkMain.Worksheets("Sheet1")
msgbox mobjWkShMain.Cells(0,0)

mobjWkBkMain.close
set mobjWkBkMain  = nothing
Set mobjWkShMain = nothing
mobjExcelApp.quit
set mobjExcelApp = nothing
0
 

Author Comment

by:harishkg
ID: 21831418
this is how its read from excel, but the message box displays the data as ????
0
 
LVL 10

Accepted Solution

by:
3_S earned 150 total points
ID: 21840044
You can read and store all the data as unicode, but it is not possible to pass it to another application as ASCII, since unicode uses 2 bytes (and ascii 1byte) so you cannot represent each unicode charachter as ascii code)  therefore you get the data represented as ???
Standard messagebox uses ascii characterset so you get ??? for unicode characters.
0
 
LVL 7

Expert Comment

by:Dauhee
ID: 21840381
yep 3_S ya got it there!!
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

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

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
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 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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month15 days, 23 hours left to enroll

850 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