HTML string not formatting when copied into sheet

W

WhytheQ

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:
<html>helloworld</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
Before:=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
'======================
 

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