Solved

Foreign Characters from Excel VBA Web QueryTable Translations

Posted on 2010-08-22
4
1,029 Views
Last Modified: 2012-05-10
This references http://www.experts-exchange.com/Software/Office_Productivity/Office_Suites/MS_Office/Excel/Q_26413569.html#deleteNotice
After completing an Excel2007 VBA modified querytable to http://translate.reference.com/  I get results which are good and results that are not seemingly usable.  The good results are those that can be expressed in standard English characters. Any accented characters seem to be returned with some kind of two character codes. Any completely foreign set (Greek, Chinese, Hebrew, Arabic, etc.) comes back as <I am not sure what>.
Please see attached file.
My question is - how to go from the character codes returned to the appropriate foreign equivalent - as in looking like the manually copy/pasted results in Column D.
Regards
Brian     QueryTableTranslate.xls
0
Comment
Question by:canesbr
  • 2
4 Comments
 
LVL 27

Expert Comment

by:jjafferr
ID: 33507078
Hi

If you can click on the "copy to clipboard", then paste the translation to your excel sheet.

If you use the webbrowser object like this:
Private web As WebBrowser

then I think that button is number 365, and you can click it like this:
web.Document.all(365).click

jaffer
0
 
LVL 32

Expert Comment

by:Robberbaron (robr)
ID: 33517272
the query is returning a UniCode character, which is 2 bytes wide.

can you rewrite as an ADo connection, then use CHRW to write out the data ?

many VBA functions dont support unicode by default.
0
 
LVL 32

Accepted Solution

by:
Robberbaron (robr) earned 500 total points
ID: 33517814
rewritten to use XML.Get in place of the Excel Webquery.

then parse the returned data to get strings... these are Unicode and transfer correctly.

Sheet1 is now redundant i suspect.

Private Function GetWebPage(ByRef URL As String) As String
    Dim xml 'As IXMLHTTPRequest
    Set xml = CreateObject("Microsoft.XMLHTTP")
    With xml
        .Open "GET", URL, False
        .send
        GetWebPage = .responseText
    End With
    Set xml = Nothing
End Function

Open in new window

Update-QueryTableTranslate.xls
0
 

Author Closing Comment

by:canesbr
ID: 33522938
Fantasmagorical! That's exactly it!
ThanQ
Regards
Brian
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

What is a Form List Box? (skip if you know this) The forms List Box is the alternative to the ActiveX list box. If you are using excel 2007, you first make sure you have a developer tab (click the Orb)->"Excel Options"->Popular->"Show Developer tab…
Approximate matching with VLOOKUP and MATCH seems to me to be a greatly under-used technique, and one which is vital for getting good performance out of large lookups. Until recently I would always have advised using an exact match for simplicity an…
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…

743 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

16 Experts available now in Live!

Get 1:1 Help Now