When using VBA to parse HTML in a cell row, some tags like give problems.
For example, if I have the following content in a excel cell:
<div><section>hello</section></div>
And I then apply the following function
Public Function mainclean(sourceText As String) As String
Dim DOC As New HTMLDocument
DOC.body.innerHTML = sourceText
mainclean = DOC.body.innerHTML
End Function
What I get is the following:
<DIV>hello</SECTION></DIV>
The beginning of the section tag is being stripped. Clearly the tag section is not being recognised as HTML code.
The same happens with non-html tags like <mycustomtag></mycustomtag>
Does it exist any workaround?
Thanks
sourceTextas a string. You declaredDOCas HTMLDocument but then you turn it into a string withDOC.body.innerHTML = sourceText. Just a guess though.HTMLDocumentimplements the latest version of IE - you may find that recent/HTML5 tags are not supported.innerHTMLagainstinnerText. Your html code is in Excel cells because? I've never heard that's necessary.