Solved

Unicode and ASCII

Posted on 2008-06-19
4
966 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
Comment Utility
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
Comment Utility
this is how its read from excel, but the message box displays the data as ????
0
 
LVL 10

Accepted Solution

by:
3_S earned 50 total points
Comment Utility
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
Comment Utility
yep 3_S ya got it there!!
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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…
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…

763 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

6 Experts available now in Live!

Get 1:1 Help Now