How do I convert HTML tags within cell to text?

  • Thread starter Thread starter Datraveller
  • Start date Start date
D

Datraveller

I have an XLS extract from a system that has included the HTML tags within
the cell. How do I go about converting this to text where possible and
removing it where not?
 
You could try something like this. Modify to suit.

Need to add a project reference to "Microsoft HTML Object Library"

Tim

'**************************
Option Explicit

Sub Tester()
Dim c As Range
Dim oDoc As HTMLDocument
Set oDoc = New HTMLDocument

For Each c In Selection

oDoc.body.innerHTML = c.Value
c.Offset(0, 1).Value = oDoc.body.innerText

Next c


End Sub
'******************************
 
Back
Top