Web query and carriage returns
When I do a web query on an html table, any carriage returns in the
html table cells are treated as row delimiters.
For example, if a single cell in the html table looks like this:
Before Carriage Return
After Carriage Return
Then that cell gets imported to two worksheet rows.
Is there any way to get it to import each html table cell into a
single worksheet cell?
Here's what I'm doing:
Function DownloadTableFromWebByConnStr(dest_range As Range,
connection_string As String) As Boolean
'returns True on success.
Dim strConnection As String
Dim qtQueryTable As QueryTable
Dim bDisplayAlertsStatus As Boolean
bDisplayAlertsStatus = Application.DisplayAlerts
Application.DisplayAlerts = False
Set qtQueryTable =
dest_range.Parent.QueryTables.Add(connection_strin g,
Destination:=dest_range)
With qtQueryTable
.Name = "Full International Table"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = False 'True 'False
.RefreshOnFileOpen = False
.BackgroundQuery = False
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlAllTables 'xlSpecifiedTables
.WebFormatting = xlWebFormattingNone
' .WebTables = "1"
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With
qtQueryTable.Delete
Call FixBooleansAfterImport(dest_range)
Application.DisplayAlerts = bDisplayAlertsStatus
DownloadTableFromWebByConnStr = True
End Function
Thanks,
Greg
|