Dim dhtmldoc As HTMLDocument
Dim dhtmlbody As HTMLBody
Dim DHTMLEC As HTMLElementCollection
Dim DELEM As IHTMLElement
Dim obj As Object


' Dim dhtmlelement As HTML

Set dhtmldoc = WebPreview.Document
Set dhtmlbody = WebPreview.Document.body


Set dhtmlbody = WebPreview.Document.body

' dhtmlbody.outerHTML = "<h1>hi</h>"
' dhtmlbody.innerHTML = "<body><h1>there</h></body>"
WebPreview.Navigate2 (ckRSlash(G_UserDir) + "comp.html")

Call ClearWebPreview

WebPreview.Document.body.insertAdjacentHTML "afterEnd", "<h1>there</h>"
WebPreview.Document.body.insertAdjacentHTML "BeforeEnd", "<h1>tdddhere</h>"

WebPreview.Document.body.insertAdjacentHTML "BeforeEnd", "<Table BORDER=2><TR><TD ID=MARK>hello</TD></TR></Table>"

'Set DHTMLEC = WebPreview.Document.All("TD")
'For Each OBJ In DHTMLEC
' Debug.Print
'Next

Dim hctableCellEC As IHTMLElementCollection
'Dim hFontElement As IHTMLFontElement
Dim hTableCell As HTMLTableCell
Dim cellcounter As Integer

cellcounter = 1
Set hctableCellEC = WebPreview.Document.body.getElementsByTagName("TD")


For Each hTableCell In hctableCellEC
'Debug.Print "innertext" & hCell.innerText

'hCell.Color
If cellcounter = hctableCellEC.Length Then
Call hTableCell.insertAdjacentHTML("BeforeEnd", "<TR><TD>holy moly</TD></TR>")
Else
cellcounter = cellcounter + 1
End If
Next
cellcounter = 1
Set hctableCellEC = WebPreview.Document.body.getElementsByTagName("TD")
For Each hTableCell In hctableCellEC
'Debug.Print "innertext" & hCell.innerText

'hCell.Color
If cellcounter = hctableCellEC.Length Then
Call hTableCell.insertAdjacentHTML("BeforeEnd", "<TR><TD>holy moly</TD></TR>")
Else
cellcounter = cellcounter + 1
End If
Next