Solved

Unicode and ASCII

Posted on 2008-06-19
4
979 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 50 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

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

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…
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…

688 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