ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   HTML string not formatting when copied into sheet (https://www.excelbanter.com/excel-programming/445422-html-string-not-formatting-when-copied-into-sheet.html)

WhytheQ

HTML string not formatting when copied into sheet
 
Hello All,

Any help with the following would be greatly appreciated.

I've got a two column table in SQLserver - second field contains a
long string - this string is HTML code.

Lets say there's only one record in the table and the HTML looks like
the following:
<htmlhelloworld</html

If I SELECT * from the table and then right click the contents in
SQLserver Results pain, and then paste into a worksheet, it just says
helloworld in a cell - with no tags. So I assumed if I moved this info
to Excel using ADO in my VBA then it would appear formatted
correctly.

If I use ADO with code like the following then it just appears as one
string in the cell with all the tags visible!! Anyone ever come across
this before ?

Help much appreciated
Jason.

'======================
rsExcel.MoveFirst
Do Until rsExcel.EOF

Excel.ThisWorkbook.Sheets("XXX").Copy
Befo=Excel.ThisWorkbook.Sheets("XXX")
Excel.ActiveSheet.Name = rsExcel!Game

With rsHTML
'Extract and copy the required records
.Open "SELECT myHTML" & _
" FROM WHAnalysis.dbo.tb_xxx_jq" & _
" WHERE Game= '" & rsExcel!yyy & "'"
Excel.ActiveSheet.Range("C2").CopyFromRecordset rsHTML
.Close 'close connection
End With

rsExcel.MoveNext
Loop
'======================


All times are GMT +1. The time now is 07:48 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com