View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
WhytheQ WhytheQ is offline
external usenet poster
 
Posts: 246
Default 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
'======================