How do you importing unicode from web

S

Seven

Using: Excel 2007

I want to import a table from a website using Data: From Web
http://www.fallingrain.com/world/FR/a/A/b/

The table has unicode characters but when the imported finishs the
characters are not correct. How do you specify the import to preserve the
unicode?

Macro:
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;http://www.fallingrain.com/world/FR/a/A/b",
Destination:=Range("$A$1"))
.Name = "Table aAb"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlSpecifiedTables
.WebFormatting = xlWebFormattingNone
.WebTables = "2"
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With


Thanks in advance
 
J

Joel

from
..WebFormatting = xlWebFormattingNone

to
..WebFormatting = xlWebFormattingAll


You can also use

..WebFormatting = xlWebFormattingRTF
 
N

norie

You could try this.

Sub test()

Set IE = CreateObject("InternetExplorer.Application")
With IE
.Visible = True
.Navigate "http://www.fallingrain.com/world/FR/a/A/b/"
Do Until .ReadyState = 4: DoEvents: Loop

Set doc = IE.Document
GetOneTable doc, 2, Range("A1")
.Quit
End With
End Sub

Sub GetOneTable(d, n, rngDst As Range)
' d is the document
' n is the table to extract


Dim e As Object ' the elements of the document
Dim t As Object ' the table required
Dim r As Object ' the rows of the table
Dim c As Object ' the cells of the rows.
Dim I As Long
Dim J As Long

For Each e In d.all

If e.nodename = "TABLE" Then
J = J + 1
End If

If J = n Then
Set t = e

tabno = tabno + 1

For Each r In t.Rows
For Each c In r.Cells
rngDst.Value = c.innertext
Set rngDst = rngDst.Offset(, 1)

Next c

Set rngDst = rngDst.Offset(1, -rngDst.Column + 1)
Next r

Exit For

End If

Next e

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top