Solved

Unicode and ASCII

Posted on 2008-06-19
4
973 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 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Red error squiggly on vb.net 7 27
Getting multiple values from a dataset ASP.NET(VB) 3 37
vb.net checkbox 7 42
VB 2005 Tooltips on Form Load Event 15 19
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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…
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…

864 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

17 Experts available now in Live!

Get 1:1 Help Now